Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
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. More...
 
 get_action_url ()
 Returns action URL. More...
 
 get_message ()
 Returns message text with HTML tags quoted. More...
 
 get_type ()
 Returns message type. More...
 
 set_action (moodle_url $url, $label)
 Sets the optional message action. More...
 
 set_text ($text)
 Sets the message text. More...
 
 set_type ($type=self::TYPE_INFO)
 Sets the message type. More...
 

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: