Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
MoodleQuickForm_checkbox Class Reference

checkbox form element More...

Inheritance diagram for MoodleQuickForm_checkbox:

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $text='', $attributes=null)
 Constructor.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 getFrozenHtml ()
 Returns the disabled field.
 
 getHelpButton ()
 get html for help button
 
 MoodleQuickForm_checkbox ($elementName=null, $elementLabel=null, $text='', $attributes=null)
 Old syntax of class constructor.
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element.
 
 toHtml ()
 Returns HTML for checbox form element.
 

Public Attributes

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

Detailed Description

checkbox form element

Contains HTML class for a checkbox type element

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later HTML class for a checkbox type element

Overloaded HTML_QuickForm_checkbox to add help button. Also, fixes bug in quickforms checkbox, which lets previous set value override submitted value if checkbox is not checked and no value is submitted

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_checkbox::__construct ( $elementName = null,
$elementLabel = null,
$text = '',
$attributes = null )

Constructor.

Parameters
string$elementName(optional) name of the checkbox
string$elementLabel(optional) checkbox label
string$text(optional) Text to put after the checkbox
mixed$attributes(optional) Either a typical HTML attribute string or an associative array

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_checkbox::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.

◆ getFrozenHtml()

MoodleQuickForm_checkbox::getFrozenHtml ( )

Returns the disabled field.

Accessibility: the return "[ ]" from parent class is not acceptable for screenreader users, and we DO want a label.

Return values
string

◆ getHelpButton()

MoodleQuickForm_checkbox::getHelpButton ( )

get html for help button

Return values
stringhtml for help button

◆ MoodleQuickForm_checkbox()

MoodleQuickForm_checkbox::MoodleQuickForm_checkbox ( $elementName = null,
$elementLabel = null,
$text = '',
$attributes = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_checkbox::onQuickFormEvent ( $event,
$arg,
& $caller )

Called by HTML_QuickForm whenever form event is made on this element.

Parameters
string$eventName of event
mixed$argevent arguments
object$callercalling object
Return values
bool

◆ toHtml()

MoodleQuickForm_checkbox::toHtml ( )

Returns HTML for checbox form element.

Return values
string

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