Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
single_button Class Reference
Inheritance diagram for single_button:
renderable enrol_user_button gradereport_history\output\user_button

Public Member Functions

 __construct (moodle_url $url, $label, $method='post', $primary=false, $attributes=[])
 Constructor. More...
 
 add_action (component_action $action)
 Add action to the button. More...
 
 add_confirm_action ($confirmmessage)
 Shortcut for adding a JS confirm dialog when the button is clicked. More...
 
 export_for_template (renderer_base $output)
 Export data. More...
 
 set_attribute ($name, $value)
 Sets an attribute for the HTML button tag. More...
 

Public Attributes

string $actionid
 Action id.
 
array $actions = array()
 List of attached actions.
 
string $class = 'singlebutton'
 Wrapping div class.
 
bool $disabled = false
 True if button disabled, false if normal.
 
string $formid
 Form id.
 
string $label
 Button label.
 
string $method = 'post'
 Form submit method post or get.
 
array $params
 $params URL Params
 
bool $primary = false
 True if button is primary button. More...
 
string $tooltip = null
 Button tooltip.
 
moodle_url $url
 Target url.
 

Protected Attributes

array $attributes = []
 

Constructor & Destructor Documentation

◆ __construct()

single_button::__construct ( moodle_url  $url,
  $label,
  $method = 'post',
  $primary = false,
  $attributes = [] 
)

Constructor.

Parameters
moodle_url$url
string$labelbutton text
string$methodget or post submit method
array$attributesAttributes for the HTML button tag

Member Function Documentation

◆ add_action()

single_button::add_action ( component_action  $action)

Add action to the button.

Parameters
component_action$action

◆ add_confirm_action()

single_button::add_confirm_action (   $confirmmessage)

Shortcut for adding a JS confirm dialog when the button is clicked.

The message must be a yes/no question.

Parameters
string$confirmmessageThe yes/no confirmation question. If "Yes" is clicked, the original action will occur.

◆ export_for_template()

single_button::export_for_template ( renderer_base  $output)

Export data.

Parameters
renderer_base$outputRenderer.
Return values
stdClass

◆ set_attribute()

single_button::set_attribute (   $name,
  $value 
)

Sets an attribute for the HTML button tag.

Parameters
string$nameThe attribute name
mixed$valueThe value
Return values
null

Member Data Documentation

◆ $primary

bool single_button::$primary = false

True if button is primary button.

Used for styling.


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