Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core\output\select_menu Class Reference
Inheritance diagram for core\output\select_menu:
renderable templatable

Public Member Functions

 __construct (string $name, array $options, string $selected=null)
 select_menu constructor.
 
 export_for_template (renderer_base $output)
 Export for template.
 
 set_label (string $label, array $attributes=[])
 Sets the select menu's label.
 

Protected Member Functions

 flatten_options ()
 Flatten the options for Mustache.
 

Protected Attributes

string $label
 The combobox label.
 
array $labelattributes = []
 Button label's attributes.
 
string $name
 Name of the combobox element.
 
array $options
 List of options.
 
string null $selected
 The value of the preselected option.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

core\output\select_menu::__construct ( string $name,
array $options,
string $selected = null )

select_menu constructor.

Parameters
string$nameName of the combobox element
array$optionsList of options in an associative array format like ['val' => 'Option']. Supports grouped options as well.
string | null$selectedThe value of the preselected option.

Member Function Documentation

◆ export_for_template()

core\output\select_menu::export_for_template ( renderer_base $output)

Export for template.

Parameters
renderer_base$outputThe renderer.
Return values
stdClass

Implements templatable.

◆ flatten_options()

core\output\select_menu::flatten_options ( )
protected

Flatten the options for Mustache.

Return values
array

◆ set_label()

core\output\select_menu::set_label ( string $label,
array $attributes = [] )

Sets the select menu's label.

Parameters
string$labelThe label.
array$attributesList of attributes to apply on the label element.

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