Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

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