diff --git a/lib/classes/output/notification.php b/lib/classes/output/notification.php index 12c9aaf075f..e071d6ba12d 100644 --- a/lib/classes/output/notification.php +++ b/lib/classes/output/notification.php @@ -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. * diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 2f23a8d968b..af0c9778ca4 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -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()); + } }