Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

User Alert notifications.

Copyright: 2016 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 220 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

notification:: (8 methods):
  add()
  add_call_to_action()
  fetch()
  fetch_as_array()
  success()
  info()
  warning()
  error()


Class: notification  - X-Ref

add($message, $level = null)   X-Ref
Add a message to the session notification stack.

param: string $message The message to add to the stack
param: string $level   The type of message to add to the stack

add_call_to_action(array $icon, string $message, array $actions, string $region = '')   X-Ref

param: string[] $icon The icon to use. Required keys are 'pix' and 'component'.
param: string $message The message to display.
param: array $actions An array of action links
param: string $region Optional region name

fetch()   X-Ref
Fetch all of the notifications in the stack and clear the stack.

return: array All of the notifications in the stack

fetch_as_array(\renderer_base $renderer)   X-Ref
Fetch all of the notifications in the stack and clear the stack.

return: array All of the notifications in the stack

success($message)   X-Ref
Add a success message to the notification stack.

param: string $message The message to add to the stack

info($message)   X-Ref
Add a info message to the notification stack.

param: string $message The message to add to the stack

warning($message)   X-Ref
Add a warning message to the notification stack.

param: string $message The message to add to the stack

error($message)   X-Ref
Add a error message to the notification stack.

param: string $message The message to add to the stack