1<?php
2
3use Piwik\Notification;
4
5return [
6    'observers.global' => DI\add([
7        [
8            'Request.dispatch',
9            DI\value(
10                function () {
11                    if (!empty($_GET['setNotifications']) && $_GET['setNotifications'] == 1) {
12                        // trigger some notification
13                        $notification          = new Notification('This is a persistent test notification');
14                        $notification->title   = 'Warning:';
15                        $notification->context = Notification::CONTEXT_WARNING;
16                        $notification->type    = Notification::TYPE_PERSISTENT;
17                        $notification->flags   = Notification::FLAG_CLEAR;
18                        Notification\Manager::notify('NotificationFixture_persistent_warning', $notification);
19
20                        $notification          = new Notification('This is another persistent test notification');
21                        $notification->title   = 'Error:';
22                        $notification->context = Notification::CONTEXT_ERROR;
23                        $notification->type    = Notification::TYPE_PERSISTENT;
24                        $notification->flags   = Notification::FLAG_CLEAR;
25                        Notification\Manager::notify('NotificationFixture_persistent_error', $notification);
26
27                        $notification          = new Notification('This is transient test notification');
28                        $notification->title   = 'Error:';
29                        $notification->context = Notification::CONTEXT_ERROR;
30                        $notification->type    = Notification::TYPE_TRANSIENT;
31                        $notification->flags   = Notification::FLAG_CLEAR;
32                        Notification\Manager::notify('NotificationFixture_transient_error', $notification);
33                    }
34                }
35            ),
36        ],
37    ]),
38];