Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 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

return: void
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

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

return: void
param: string    $name   Group name

getName()   X-Ref
Returns the group name

return: string

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

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

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

return: mixed

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

return: void
param: array     $elements   Array of elements

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

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

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

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

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

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

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