Moodle APIs 4.1
Moodle 4.1.9+ (Build: 20240402)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core\output\select_menu Class Reference
Inheritance diagram for core\output\select_menu:

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.
 

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: