Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 403]

(no description)

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

Defines 2 classes

HTML_QuickForm_group:: (2 methods):
  __construct()
  HTML_QuickForm_group()

name:: (18 methods):
  setName()
  getName()
  setValue()
  getValue()
  setElements()
  getElements()
  getGroupType()
  toHtml()
  getElementName()
  getFrozenHtml()
  onQuickFormEvent()
  accept()
  exportValue()
  _createElements()
  _createElementsIfNotExist()
  freeze()
  unfreeze()
  setPersistantFreeze()


Class: HTML_QuickForm_group  - X-Ref

HTML class for a form element group

__construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)   X-Ref
Class constructor

param: string    $elementName    (optional)Group name
param: array     $elementLabel   (optional)Group label
param: array     $elements       (optional)Group elements
param: mixed     $separator      (optional)Use a string for one separator,
param: bool      $appendName     (optional)whether to change elements' names to
return: void

HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

setName($name)   X-Ref
Sets the group name

param: string    $name   Group name
return: void

getName()   X-Ref
Returns the group name

return: string

setValue($value)   X-Ref
Sets values for group's elements

param: mixed    Values for group's elements
return: void

getValue()   X-Ref
Returns the value of the group

return: mixed

setElements($elements)   X-Ref
Sets the grouped elements

param: array     $elements   Array of elements
return: void

getElements()   X-Ref
Gets the grouped elements

return: array

getGroupType()   X-Ref
Gets the group type based on its elements
Will return 'mixed' if elements contained in the group
are of different types.

return: string    group elements type

toHtml()   X-Ref
Returns Html for the group

return: string

getElementName($index)   X-Ref
Returns the element name inside the group such as found in the html form

param: mixed     $index  Element name or element index in the group
return: mixed     string with element name, false if not found

getFrozenHtml()   X-Ref
Returns the value of field without HTML tags

return: string

onQuickFormEvent($event, $arg, &$caller)   X-Ref
Called by HTML_QuickForm whenever form event is made on this element

param: string    $event  Name of event
param: mixed     $arg    event arguments
param: object    $caller calling object
return: void

accept(&$renderer, $required = false, $error = null)   X-Ref
Accepts a renderer

param: object     An HTML_QuickForm_Renderer object
param: bool       Whether a group is required
param: string     An error message associated with a group
return: void

exportValue(&$submitValues, $assoc = false)   X-Ref
As usual, to get the group's value we access its elements and call
their exportValue() methods


_createElements()   X-Ref
Creates the group's elements.

This should be overriden by child classes that need to create their
elements. The method will be called automatically when needed, calling
it from the constructor is discouraged as the constructor is usually
called _twice_ on element creation, first time with _no_ parameters.


_createElementsIfNotExist()   X-Ref
A wrapper around _createElements()

This method calls _createElements() if the group's _elements array
is empty. It also performs some updates, e.g. freezes the created
elements if the group is already frozen.


freeze()   X-Ref
No description

unfreeze()   X-Ref
No description

setPersistantFreeze($persistant = false)   X-Ref
No description