Data structure representing a notification.
More...
|
| __construct ( $message, $messagetype=null, $closebutton=true, ?string $title=null, ?string $titleicon=null) |
| Notification constructor.
|
|
| export_for_template (\renderer_base $output) |
| Export this data so it can be used as the context for a mustache template.
|
|
| export_for_template (renderer_base $output) |
| Function to export the renderer data in a format that is suitable for a mustache template.
|
|
| get_message () |
| Get the message for this notification.
|
|
| get_message_type () |
| Get the message type for this notification.
|
|
| get_template_name () |
| Get the name of the template to use for this templatable.
|
|
| set_announce ($announce=false) |
| Set whether this notification should be announced assertively to screen readers.
|
|
| set_extra_classes ($classes=[]) |
| Add any extra classes that this notification requires.
|
|
| set_show_closebutton ($button=false) |
| Set whether this notification should include a button to disiss itself.
|
|
|
const | NOTIFY_ERROR = 'error' |
| A notification of level 'error'.
|
|
const | NOTIFY_INFO = 'info' |
| A notification of level 'info'.
|
|
const | NOTIFY_SUCCESS = 'success' |
| A notification of level 'success'.
|
|
const | NOTIFY_WARNING = 'warning' |
| A notification of level 'warning'.
|
|
|
bool | $announce = true |
| $announce Whether this notification should be announced assertively to screen readers.
|
|
bool | $closebutton = true |
| $closebutton Whether this notification should inlcude a button to dismiss itself.
|
|
array | $extraclasses = [] |
| $extraclasses A list of any extra classes that may be required.
|
|
string | $message = '' |
| Message payload.
|
|
string | $messagetype = self::NOTIFY_WARNING |
| Message type.
|
|
string string | $title = null |
| Title payload.
|
|
string string | $titleicon = null |
| Title icon name.
|
|
Data structure representing a notification.
- Copyright
- 2015 Jetha Chan
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- Since
- Moodle 2.9
◆ __construct()
core\output\notification::__construct |
( |
| $message, |
|
|
| $messagetype = null, |
|
|
| $closebutton = true, |
|
|
?string | $title = null, |
|
|
?string | $titleicon = null ) |
Notification constructor.
- Parameters
-
string | $message | the message to print out |
?string | $messagetype | one of the NOTIFY_* constants.. |
bool | $closebutton | Whether to show a close icon to remove the notification (default true). |
?string | $title | the title of the notification |
?string | $titleicon | if the title should have an icon you can give the icon name with the component (e.g. 'i/circleinfo, core' or 'i/circleinfo' if the icon is from core |
◆ export_for_template() [1/2]
core\output\notification::export_for_template |
( |
\renderer_base | $output | ) |
|
Export this data so it can be used as the context for a mustache template.
- Parameters
-
renderer_base | $output | typically, the renderer that's calling this function |
- Return values
-
array | data context for a mustache template |
◆ export_for_template() [2/2]
core\output\templatable::export_for_template |
( |
renderer_base | $output | ) |
|
|
inherited |
Function to export the renderer data in a format that is suitable for a mustache template.
This means:
- No complex types - only stdClass, array, int, string, float, bool
- Any additional info that is required for the template is pre-calculated (e.g. capability checks).
- Parameters
-
renderer_base | $output | Used to do a final render of any components that need to be rendered for export. |
- Return values
-
Implemented in core\output\action_menu, core\output\actions\component_action, core\output\activity_header, core\output\checkbox_toggleall, core\output\choicelist, core\output\chooser, core\output\chooser_item, core\output\chooser_section, core\output\comboboxsearch, core\output\context_header, core\output\custom_menu_item, core\output\dynamic_tabs, core\output\help_icon, core\output\initials_bar, core\output\paging_bar, core\output\pix_icon, core\output\pix_icon_font, core\output\progress_bar, core\output\select_menu, core\output\single_select, core\output\tabobject, core\output\tabtree, core\output\task_indicator, core\output\url_select, core_calendar\output\humandate, core_calendar\output\humantimeperiod, core_course\output\actionbar\group_selector_button, core_course\output\actionbar\group_selector_dropdown_form, core_course\output\actionbar\initials_dropdown_form, core_course\output\actionbar\user_selector_button, core_course\output\activity_completion, core_course\output\activity_dates, core_course\output\activity_icon, core_course\output\activitychooserbutton, core_course\output\completion_action_bar, core_courseformat\output\local\content\basecontrolmenu, core_courseformat\output\local\content\cm\controlmenu, core_courseformat\output\local\content\cm, core_courseformat\output\local\content\section, core_courseformat\output\local\overview\activityname, core_courseformat\output\local\overview\overviewtable, core_grades\output\penalty_indicator, core_reportbuilder\output\custom_report, core_reportbuilder\output\dynamictabs\access, core_reportbuilder\output\dynamictabs\audience, core_reportbuilder\output\dynamictabs\editor, core_reportbuilder\output\dynamictabs\schedules, core_reportbuilder\output\report_action, and core_reportbuilder\output\system_report.
◆ get_message()
core\output\notification::get_message |
( |
| ) |
|
Get the message for this notification.
- Return values
-
◆ get_message_type()
core\output\notification::get_message_type |
( |
| ) |
|
Get the message type for this notification.
- Return values
-
◆ get_template_name()
core\output\notification::get_template_name |
( |
| ) |
|
Get the name of the template to use for this templatable.
- Return values
-
◆ set_announce()
core\output\notification::set_announce |
( |
| $announce = false | ) |
|
Set whether this notification should be announced assertively to screen readers.
- Parameters
-
- Return values
-
◆ set_extra_classes()
core\output\notification::set_extra_classes |
( |
| $classes = [] | ) |
|
Add any extra classes that this notification requires.
- Parameters
-
- Return values
-
◆ set_show_closebutton()
core\output\notification::set_show_closebutton |
( |
| $button = false | ) |
|
Set whether this notification should include a button to disiss itself.
- Parameters
-
- Return values
-
The documentation for this class was generated from the following file:
- lib/classes/output/notification.php