Hi!
I’m totally stack on this question. ExampleUI say one way to use it, descriptions from Notification class say second, source code say third way to use.
I’m try this code in index() method of my controller
public function index() {
$notification = new Notification('Success');
$notification->context = Notification::CONTEXT_SUCCESS;
$notification->type = Notification::TYPE_TOAST;
Notification\Manager::notify('myUniqueNotificationIdT', $notification);
$view = new View('@Counter/default.twig');
$this->setGeneralVariablesView($view);
$this->setBasicVariablesView($view);
$view->topMenu = MenuTop::getInstance()->getMenu();
$view->userMenu = MenuUser::getInstance()->getMenu();
$view->adminMenu = MenuAdmin::getInstance()->getMenu();
$view->notifications = $notification;
return $view->render();
}
And in template
{% extends "admin.twig" %}
{% block content %}
<div id="myUniqueNotificationIdT">
{% if notifications|length %}
{% for notificationId, n in notifications %}
123
{{ n.message|notification({'id': notificationId, 'type': n.type, 'title': n.title, 'noclear': n.hasNoClear, 'context': n.context, 'raw': n.raw}, false) }}
{% endfor %}
{% endif %}
</div>
{% endblock %}
But no notifications is displayed. What’s wrong?