Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
MoodleQuickForm_group Class Reference

HTML class for a form element group. More...

Inheritance diagram for MoodleQuickForm_group:
templatable MoodleQuickForm_date_selector MoodleQuickForm_date_time_selector MoodleQuickForm_defaultcustom MoodleQuickForm_duration MoodleQuickForm_filetypes MoodleQuickForm_modgrade

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName=true)
 constructor
 
 accept (&$renderer, $required=false, $error=null)
 Accepts a renderer.
 
 createFormElement ()
 Creates an element to add to the group Expects the same arguments as MoodleQuickForm\createElement()
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 getAttributesForFormElement ()
 Return attributes suitable for passing to {.
 
 getElementTemplateType ()
 Returns element template, nodisplay/static/fieldset.
 
string getHelpButton ()
 template type, would cause problems with client side validation so will leave for now
 
 MoodleQuickForm_group ($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName=true)
 Old syntax of class constructor.
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element.
 
 setElements ($elements)
 Sets the grouped elements and hides label.
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden.
 
 setMoodleForm ($mform)
 Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement().
 
 validateSubmitValue ($values)
 Calls the validateSubmitValue function for the containing elements and returns an error string as soon as it finds one.
 

Public Attributes

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

Protected Attributes

bool $_hiddenLabel = false
 if true label will be hidden.
 
MoodleQuickForm $_mform = null
 
 $_renderedfromtemplate = false
 

Detailed Description

HTML class for a form element group.

Overloaded HTML_QuickForm_group with default behavior modified for Moodle.

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_group::__construct ( $elementName = null,
$elementLabel = null,
$elements = null,
$separator = null,
$appendName = true )

constructor

Parameters
string$elementName(optional) name of the group
string$elementLabel(optional) group label
array$elements(optional) array of HTML_QuickForm_element elements to group
string$separator(optional) string to seperate elements.
string$appendName(optional) string to appened to grouped elements.

Member Function Documentation

◆ accept()

MoodleQuickForm_group::accept ( & $renderer,
$required = false,
$error = null )

Accepts a renderer.

Parameters
objectAn HTML_QuickForm_Renderer object
boolWhether a group is required
stringAn error message associated with a group
Return values
void

Reimplemented in MoodleQuickForm_date_selector, MoodleQuickForm_date_time_selector, MoodleQuickForm_defaultcustom, MoodleQuickForm_duration, and MoodleQuickForm_filetypes.

◆ export_for_template()

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

Reimplemented in MoodleQuickForm_date_selector, and MoodleQuickForm_date_time_selector.

◆ getAttributesForFormElement()

MoodleQuickForm_group::getAttributesForFormElement ( )

Return attributes suitable for passing to {.

See also
createFormElement}, comprised of all group attributes without ID in order to ensure uniqueness of that value within the group
Return values
array

◆ getElementTemplateType()

MoodleQuickForm_group::getElementTemplateType ( )

Returns element template, nodisplay/static/fieldset.

Return values
string

◆ getHelpButton()

string MoodleQuickForm_group::getHelpButton ( )

template type, would cause problems with client side validation so will leave for now

set html for help button

◆ MoodleQuickForm_group()

MoodleQuickForm_group::MoodleQuickForm_group ( $elementName = null,
$elementLabel = null,
$elements = null,
$separator = null,
$appendName = true )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ onQuickFormEvent()

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

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

If this function is overridden and parent is not called the element must be responsible for storing the MoodleQuickForm object, see MoodleQuickForm_group::setMoodleForm()

Parameters
string$eventName of event
mixed$argevent arguments
mixed$callercalling object

Reimplemented in MoodleQuickForm_date_selector, MoodleQuickForm_date_time_selector, MoodleQuickForm_defaultcustom, MoodleQuickForm_duration, MoodleQuickForm_filetypes, and MoodleQuickForm_modgrade.

◆ setElements()

MoodleQuickForm_group::setElements ( $elements)

Sets the grouped elements and hides label.

Parameters
array$elements

◆ setHiddenLabel()

MoodleQuickForm_group::setHiddenLabel ( $hiddenLabel)

Sets label to be hidden.

Parameters
bool$hiddenLabelsets if label should be hidden

◆ setMoodleForm()

MoodleQuickForm_group::setMoodleForm ( $mform)

Stores the form this element was added to This object is later used by MoodleQuickForm_group::createElement().

Parameters
null | MoodleQuickForm$mform

◆ validateSubmitValue()

MoodleQuickForm_group::validateSubmitValue ( $values)

Calls the validateSubmitValue function for the containing elements and returns an error string as soon as it finds one.

Parameters
array$valuesValues of the containing elements.
Return values
string|nullValidation error message or null.

Reimplemented in MoodleQuickForm_filetypes.


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