Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
workshop_message Class Reference

Renderable message to be displayed to the user. More...

Inheritance diagram for workshop_message:
renderable

Public Member Functions

 __construct ($text=null, $type=self::TYPE_INFO)
 
 get_action_label ()
 Returns action label.
 
 get_action_url ()
 Returns action URL.
 
 get_message ()
 Returns message text with HTML tags quoted.
 
 get_type ()
 Returns message type.
 
 set_action (moodle_url $url, $label)
 Sets the optional message action.
 
 set_text ($text)
 Sets the message text.
 
 set_type ($type=self::TYPE_INFO)
 Sets the message type.
 

Public Attributes

const TYPE_ERROR = 30
 
const TYPE_INFO = 10
 
const TYPE_OK = 20
 

Protected Attributes

string $actionlabel = ''
 
moodle_url $actionurl = null
 
string $text = ''
 
int $type = self::TYPE_INFO
 

Detailed Description

Renderable message to be displayed to the user.

Message can contain an optional action link with a label that is supposed to be rendered as a button or a link.

See also
workshop\renderer\render_workshop_message()

Constructor & Destructor Documentation

◆ __construct()

workshop_message::__construct ( $text = null,
$type = self::TYPE_INFO )
Parameters
string$textshort text to be displayed
string$typeoptional message type info|ok|error

Member Function Documentation

◆ get_action_label()

workshop_message::get_action_label ( )

Returns action label.

Return values
string

◆ get_action_url()

workshop_message::get_action_url ( )

Returns action URL.

Return values
moodle_url|null

◆ get_message()

workshop_message::get_message ( )

Returns message text with HTML tags quoted.

Return values
string

◆ get_type()

workshop_message::get_type ( )

Returns message type.

Return values
int

◆ set_action()

workshop_message::set_action ( moodle_url $url,
$label )

Sets the optional message action.

Parameters
moodle_url$urlto follow on action
string$labelaction label

◆ set_text()

workshop_message::set_text ( $text)

Sets the message text.

Parameters
string$textshort text to be displayed

◆ set_type()

workshop_message::set_type ( $type = self::TYPE_INFO)

Sets the message type.

Parameters
int$type

The documentation for this class was generated from the following file: