Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

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: \core\output\notification[] 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