45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
function st_notification_get_color(Notification $notification)
|
|
{
|
|
$type = $notification->getType();
|
|
|
|
$colors = array(
|
|
stNotification::TYPE_INFO => 'color-info',
|
|
stNotification::TYPE_SUCCESS => 'color-success',
|
|
stNotification::TYPE_WARNING => 'color-warning',
|
|
stNotification::TYPE_ALERT => 'color-danger',
|
|
);
|
|
|
|
$color = $colors[$type];
|
|
|
|
return content_tag('span', '', array(
|
|
'class' => 'notification-color',
|
|
'style' => "background: var(--$color);",
|
|
));
|
|
}
|
|
|
|
function st_notification_get_icon(Notification $notification, array $options = array())
|
|
{
|
|
$icon = $notification->getIcon();
|
|
|
|
if ($icon)
|
|
{
|
|
$color = st_notification_get_color($notification);
|
|
|
|
return st_backend_get_icon($icon, $options) . $color;
|
|
}
|
|
else
|
|
{
|
|
$icons = array(
|
|
stNotification::TYPE_INFO => 'info',
|
|
stNotification::TYPE_SUCCESS => 'check-circle',
|
|
stNotification::TYPE_WARNING => 'warning',
|
|
stNotification::TYPE_ALERT => 'error',
|
|
);
|
|
|
|
$type = $notification->getType();
|
|
|
|
return st_backend_get_icon($icons[$type], $options);
|
|
}
|
|
} |