Skip to content

Instantly share code, notes, and snippets.

@thyseus
Created January 20, 2017 12:17
Show Gist options
  • Select an option

  • Save thyseus/ca215c95bc77e56f45225a8ae316c4f8 to your computer and use it in GitHub Desktop.

Select an option

Save thyseus/ca215c95bc77e56f45225a8ae316c4f8 to your computer and use it in GitHub Desktop.
foreach (Yii::$app->session->getAllFlashes() as $message):; ?>
<?php
if ($message) {
if (is_array($message))
echo \kartik\widgets\Growl::widget([
'type' => (!empty($message['type'])) ? $message['type'] : 'danger',
'title' => (!empty($message['title'])) ? $message['title'] : 'Title Not Set!',
'icon' => (!empty($message['icon'])) ? $message['icon'] : 'fa fa-info',
'body' => (!empty($message['message'])) ? $message['message'] : 'Message Not Set!',
'showSeparator' => true,
'delay' => 0, //This delay is how long before the message shows
'pluginOptions' => [
'offset' => ['y' => 70, 'x' => 0],
'delay' => (!empty($message['duration'])) ? $message['duration'] : 3000, //This delay is how long the message shows for
'placement' => [
'from' => (!empty($message['positonY'])) ? $message['positonY'] : 'top',
'align' => (!empty($message['positonX'])) ? $message['positonX'] : 'right',
]
]
]);
else
echo \kartik\widgets\Growl::widget([
'type' => (!empty($message['type'])) ? $message['type'] : 'warning',
'title' => 'Nachricht: ',
'icon' => 'fa fa-info',
'body' => $message,
'showSeparator' => true,
'delay' => 0,
'pluginOptions' => [
'offset' => ['y' => 70, 'x' => 0],
'delay' => 2000,
'placement' => [
'from' => 'top',
'align' => 'right',
]
]
]);
}
?>
<?php endforeach; ?>
foreach (Yii::$app->session->getAllFlashes() as $message):; ?>
<?php
if ($message) {
if (is_array($message))
echo \kartik\widgets\Growl::widget([
'type' => (!empty($message['type'])) ? $message['type'] : 'danger',
'title' => (!empty($message['title'])) ? $message['title'] : 'Title Not Set!',
'icon' => (!empty($message['icon'])) ? $message['icon'] : 'fa fa-info',
'body' => (!empty($message['message'])) ? $message['message'] : 'Message Not Set!',
'showSeparator' => true,
'delay' => 0, //This delay is how long before the message shows
'pluginOptions' => [
'offset' => ['y' => 70, 'x' => 0],
'delay' => (!empty($message['duration'])) ? $message['duration'] : 3000, //This delay is how long the message shows for
'placement' => [
'from' => (!empty($message['positonY'])) ? $message['positonY'] : 'top',
'align' => (!empty($message['positonX'])) ? $message['positonX'] : 'right',
]
]
]);
else
echo \kartik\widgets\Growl::widget([
'type' => (!empty($message['type'])) ? $message['type'] : 'warning',
'title' => 'Nachricht: ',
'icon' => 'fa fa-info',
'body' => $message,
'showSeparator' => true,
'delay' => 0,
'pluginOptions' => [
'offset' => ['y' => 70, 'x' => 0],
'delay' => 2000,
'placement' => [
'from' => 'top',
'align' => 'right',
]
]
]);
}
?>
<?php endforeach; ?>
@thyseus

thyseus commented Jan 20, 2017

Copy link
Copy Markdown
Author

Yii::$app->getSession()->setFlash('warning', [
'type' => 'warning',
'duration' => 5000,
'icon' => 'fa fa-users',
'title' => 'Achtung!',
'message' => 'Sie haben ' . $unread . ' ungelesene Nachrichten in ihrem Postfach.
'
. Html::a('Zum Postfach', ['/message/message/inbox']) . '
'
. Html::a('Alle als gelesen markieren', ['/message/message/mark-all-as-read']),
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment