NotificationService
This service class contains functions related to the notification functionality.
All public functions are available in the Twig template renderer.
Namespace
IO\Services
Type | Name | Description |
---|---|---|
|
Methods
public __construct($sessionStorageRepository)
BasketService constructor.
Type |
Name |
Description |
|
public getNotifications($clear = true):array
Get a list of all notifications stored in the session
Type |
Name |
Description |
|
Optional: If true, notifications are cleared from the session afterwards (Default: true) |
public log($message, $code, $placeholder = [])
Shorthand for addNotification() with LogLevel::LOG
Type |
Name |
Description |
|
The notifications message |
|
|
Optional: Message code (Default: 0) |
|
|
Optional: A placeholder |
public info($message, $code, $placeholder = [])
Shorthand for addNotification() with LogLevel::INFO
Type |
Name |
Description |
|
The notifications message |
|
|
Optional: Message code (Default: 0) |
|
|
Optional: A placeholder |
public warn($message, $code, $placeholder = [])
Shorthand for addNotification() with LogLevel::WARN
Type |
Name |
Description |
|
The notifications message |
|
|
Optional: Message code (Default: 0) |
|
|
Optional: A placeholder |
public error($message, $code, $placeholder = [])
Shorthand for addNotification() with LogLevel::ERROR
Type |
Name |
Description |
|
The notifications message |
|
|
Optional: Message code (Default: 0) |
|
|
Optional: A placeholder |
public success($message, $code, $placeholder = [])
Shorthand for addNotification() with LogLevel::SUCCESS
Type |
Name |
Description |
|
The notifications message |
|
|
Optional: Message code (Default: 0) |
|
|
Optional: A placeholder |
public addNotificationCode($type, $code, $placeholder = [])
Shorthand for addNotification() with empty message and variable type
Type |
Name |
Description |
|
The type of notification |
|
|
Optional: Message code (Default: 0) |
|
|
Optional: A placeholder |
public hasNotifications():bool
Check if the session currently has any notifications
public clearNotifications()
Clear existing notifications