1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 02:16:06 +02:00

MDL-54164 notification: Add notification render to CLI renderer

This commit is contained in:
Ryan Wyllie 2016-05-18 01:48:37 +00:00
parent ccf323d571
commit 073fcb5aa1
2 changed files with 29 additions and 0 deletions

@ -157,6 +157,24 @@ class notification implements \renderable, \templatable {
return $this;
}
/**
* Get the message for this notification.
*
* @return string message
*/
public function get_message() {
return $this->message;
}
/**
* Get the message type for this notification.
*
* @return string message type
*/
public function get_message_type() {
return $this->messagetype;
}
/**
* Export this data so it can be used as the context for a mustache template.
*

@ -4372,6 +4372,17 @@ class core_renderer_cli extends core_renderer {
* footer method to prevent the default footer.
*/
public function footer() {}
/**
* Render a notification (that is, a status message about something that has
* just happened).
*
* @param \core\output\notification $notification the notification to print out
* @return string plain text output
*/
public function render_notification(\core\output\notification $notification) {
return $this->notification($notification->get_message(), $notification->get_message_type());
}
}