Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 172 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

select_menu:: (5 methods):
  __construct()
  set_label()
  flatten_options()
  get_selected_option()
  export_for_template()


Class: select_menu  - X-Ref

A single-select combobox widget that is functionally similar to an HTML select element.

__construct(string $name, array $options, string $selected = null)   X-Ref
select_menu constructor.

param: string $name Name of the combobox element
param: array $options List of options in an associative array format like ['val' => 'Option'].
param: string|null $selected The value of the preselected option.

set_label(string $label, array $attributes = [])   X-Ref
Sets the select menu's label.

param: string $label The label.
param: array $attributes List of attributes to apply on the label element.

flatten_options()   X-Ref
Flatten the options for Mustache.

return: array

get_selected_option()   X-Ref
Return the name of the selected option.

return: string|null The name of the selected option or null.

export_for_template(renderer_base $output)   X-Ref
Export for template.

param: renderer_base $output The renderer.
return: \stdClass