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

HTML class for a button type element. More...

Inheritance diagram for MoodleQuickForm_button:
templatable

Public Member Functions

 __construct ($elementName=null, $value=null, $attributes=null, $options=[])
 constructor
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 getElementTemplateType ()
 Slightly different container template when frozen.
 
 getHelpButton ()
 get html for help button
 
 MoodleQuickForm_button ($elementName=null, $value=null, $attributes=null)
 Old syntax of class constructor.
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden.
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 

Protected Attributes

bool $_hiddenLabel = false
 if true label will be hidden.
 
null string $customclassoverride
 Any class apart from 'btn' would be overridden with this content.
 

Detailed Description

HTML class for a button type element.

Overloaded HTML_QuickForm_button to add help button

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_button::__construct ( $elementName = null,
$value = null,
$attributes = null,
$options = [] )

constructor

Parameters
string$elementName(optional) name for the button
string$value(optional) value for the button
mixed$attributes(optional) Either a typical HTML attribute string or an associative array
array$optionsOptions to further customise the button. Currently accepted options are: customclassoverride String The CSS class to use for the button instead of the standard btn-primary and btn-secondary classes.

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_button::export_for_template ( renderer_base $output)

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

◆ getElementTemplateType()

MoodleQuickForm_button::getElementTemplateType ( )

Slightly different container template when frozen.

Return values
string

◆ getHelpButton()

MoodleQuickForm_button::getHelpButton ( )

get html for help button

Return values
stringhtml for help button

◆ MoodleQuickForm_button()

MoodleQuickForm_button::MoodleQuickForm_button ( $elementName = null,
$value = null,
$attributes = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ setHiddenLabel()

MoodleQuickForm_button::setHiddenLabel ( $hiddenLabel)

Sets label to be hidden.

Parameters
bool$hiddenLabelsets if label should be hidden

Member Data Documentation

◆ $customclassoverride

null string MoodleQuickForm_button::$customclassoverride
protected

Any class apart from 'btn' would be overridden with this content.

By default, buttons will utilize the btn-secondary class. However, there are cases where we require a button with different stylings (e.g. btn-primary). In these cases, $customclassoverride will override the defaults mentioned previously and utilize the provided class(es).

$customclassoverride Custom class override for the input element


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