Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | List of all members
MoodleQuickForm_selectwithlink Class Reference
Inheritance diagram for MoodleQuickForm_selectwithlink:
templatable

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null)
 constructor More...
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template. More...
 
 exportValue (&$submitValues, $assoc=false)
 We check the options and return only the values that could have been selected. More...
 
 getElementTemplateType ()
 Slightly different container template when frozen. More...
 
 getHelpButton ()
 get html for help button More...
 
 MoodleQuickForm_selectwithlink ($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null)
 Old syntax of class constructor. More...
 
 removeOption ($value)
 Removes an OPTION from the SELECT. More...
 
 removeOptions ()
 Removes all OPTIONs from the SELECT.
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden. More...
 
 toHtml ()
 Returns the SELECT in HTML. More...
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 
bool $_hiddenLabel =false
 if true label will be hidden
 
string $_link =null
 url to which select option will be posted
 
string $_linklabel =null
 data which will be posted to link
 
string $_linkreturn =null
 url return link
 

Constructor & Destructor Documentation

◆ __construct()

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

constructor

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

Member Function Documentation

◆ export_for_template()

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

◆ exportValue()

MoodleQuickForm_selectwithlink::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

◆ getElementTemplateType()

MoodleQuickForm_selectwithlink::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_selectwithlink::getHelpButton ( )

get html for help button

Return values
stringhtml for help button

◆ MoodleQuickForm_selectwithlink()

MoodleQuickForm_selectwithlink::MoodleQuickForm_selectwithlink (   $elementName = null,
  $elementLabel = null,
  $options = null,
  $attributes = null,
  $linkdata = null 
)

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ removeOption()

MoodleQuickForm_selectwithlink::removeOption (   $value)

Removes an OPTION from the SELECT.

Parameters
string$valueValue for the OPTION to remove

◆ setHiddenLabel()

MoodleQuickForm_selectwithlink::setHiddenLabel (   $hiddenLabel)

Sets label to be hidden.

Parameters
bool$hiddenLabelsets if label should be hidden

◆ toHtml()

MoodleQuickForm_selectwithlink::toHtml ( )

Returns the SELECT in HTML.

Return values
string

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