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

select type form element More...

Inheritance diagram for MoodleQuickForm_select:
templatable MoodleQuickForm_autocomplete MoodleQuickForm_modvisible MoodleQuickForm_selectyesno tool_lp_course_competency_rule_form_element MoodleQuickForm_cohort MoodleQuickForm_course MoodleQuickForm_searchableselector MoodleQuickForm_tags tool_lp\form\framework_autocomplete tool_lp_course_competencies_form_element

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $options=null, $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.
 
 exportValue (&$submitValues, $assoc=false)
 We check the options and return only the values that could have been selected.
 
 getElementTemplateType ()
 Slightly different container template when frozen.
 
 getHelpButton ()
 get html for help button
 
 MoodleQuickForm_select ($elementName=null, $elementLabel=null, $options=null, $attributes=null)
 Old syntax of class constructor.
 
 removeOption ($value)
 Removes an OPTION from the SELECT.
 
 removeOptions ()
 Removes all OPTIONs from the SELECT.
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden.
 
 toHtml ()
 Returns HTML for select form element.
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 
bool $_hiddenLabel =false
 if true label will be hidden
 

Detailed Description

select type form element

HTML class for a select type element

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_select::__construct ( $elementName = null,
$elementLabel = null,
$options = null,
$attributes = null )

constructor

Parameters
string$elementNameSelect name attribute
mixed$elementLabelLabel(s) for the select
mixed$optionsData to be used to populate options
mixed$attributesEither a typical HTML attribute string or an associative array

Reimplemented in MoodleQuickForm_autocomplete, MoodleQuickForm_modvisible, MoodleQuickForm_searchableselector, MoodleQuickForm_selectyesno, MoodleQuickForm_tags, tool_lp_course_competencies_form_element, and tool_lp_course_competency_rule_form_element.

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_select::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_autocomplete, and MoodleQuickForm_tags.

◆ exportValue()

MoodleQuickForm_select::exportValue ( & $submitValues,
$assoc = false )

We check the options and return only the values that could have been selected.

We also return a scalar value if select is not "multiple"

Parameters
array$submitValuessubmitted values
bool$associf true the retured value is associated array
Return values
mixed

Reimplemented in MoodleQuickForm_autocomplete, MoodleQuickForm_modvisible, and MoodleQuickForm_tags.

◆ getElementTemplateType()

MoodleQuickForm_select::getElementTemplateType ( )

Slightly different container template when frozen.

Don't want to use a label tag with a for attribute in that case for the element label but instead use a div. Templates are defined in renderer constructor.

Return values
string

◆ getHelpButton()

MoodleQuickForm_select::getHelpButton ( )

get html for help button

Return values
stringhtml for help button

◆ MoodleQuickForm_select()

MoodleQuickForm_select::MoodleQuickForm_select ( $elementName = null,
$elementLabel = null,
$options = null,
$attributes = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ removeOption()

MoodleQuickForm_select::removeOption ( $value)

Removes an OPTION from the SELECT.

Parameters
string$valueValue for the OPTION to remove
Return values
void

◆ setHiddenLabel()

MoodleQuickForm_select::setHiddenLabel ( $hiddenLabel)

Sets label to be hidden.

Parameters
bool$hiddenLabelsets if label should be hidden

◆ toHtml()

MoodleQuickForm_select::toHtml ( )

Returns HTML for select form element.

Return values
string

Reimplemented in MoodleQuickForm_autocomplete, and MoodleQuickForm_tags.


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