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.

select type form element Contains HTML class for a select type element

Copyright: 2006 Jamie Pratt <me@jamiep.org>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 231 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/form/templatable_form_element.php

Defines 2 classes

MoodleQuickForm_select:: (2 methods):
  __construct()
  MoodleQuickForm_select()

name:: (8 methods):
  setHiddenLabel()
  toHtml()
  getHelpButton()
  removeOption()
  removeOptions()
  getElementTemplateType()
  exportValue()
  export_for_template()


Class: MoodleQuickForm_select  - X-Ref

select type form element

HTML class for a select type element

__construct($elementName=null, $elementLabel=null, $options=null, $attributes=null)   X-Ref
constructor

param: string $elementName Select name attribute
param: mixed $elementLabel Label(s) for the select
param: mixed $options Data to be used to populate options
param: mixed $attributes Either a typical HTML attribute string or an associative array

MoodleQuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

setHiddenLabel($hiddenLabel)   X-Ref
Sets label to be hidden

param: bool $hiddenLabel sets if label should be hidden

toHtml()   X-Ref
Returns HTML for select form element.

return: string

getHelpButton()   X-Ref
get html for help button

return: string html for help button

removeOption($value)   X-Ref
Removes an OPTION from the SELECT

param: string $value Value for the OPTION to remove
return: void

removeOptions()   X-Ref
Removes all OPTIONs from the SELECT


getElementTemplateType()   X-Ref
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: string

exportValue(&$submitValues, $assoc = false)   X-Ref
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"

param: array $submitValues submitted values
param: bool $assoc if true the retured value is associated array
return: mixed

export_for_template(renderer_base $output)   X-Ref
No description