Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/lib/form/ -> group.php (source)

Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Form element group Contains HTML class for group form element

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

Defines 2 classes

MoodleQuickForm_group:: (2 methods):
  __construct()
  MoodleQuickForm_group()

name:: (9 methods):
  getHelpButton()
  getElementTemplateType()
  setElements()
  setMoodleForm()
  onQuickFormEvent()
  createFormElement()
  export_for_template()
  accept()
  validateSubmitValue()


Class: MoodleQuickForm_group  - X-Ref

HTML class for a form element group

Overloaded {@link HTML_QuickForm_group} with default behavior modified for Moodle.

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

param: string $elementName (optional) name of the group
param: string $elementLabel (optional) group label
param: array $elements (optional) array of HTML_QuickForm_element elements to group
param: string $separator (optional) string to seperate elements.
param: string $appendName (optional) string to appened to grouped elements.

MoodleQuickForm_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

getHelpButton()   X-Ref
set html for help button


getElementTemplateType()   X-Ref
Returns element template, nodisplay/static/fieldset

return: string

setElements($elements)   X-Ref
Sets the grouped elements and hides label

param: array $elements

setMoodleForm($mform)   X-Ref
Stores the form this element was added to
This object is later used by {@link MoodleQuickForm_group::createElement()}

param: null|MoodleQuickForm $mform

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

If this function is overridden and parent is not called the element must be responsible for
storing the MoodleQuickForm object, see {@link MoodleQuickForm_group::setMoodleForm()}

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

createFormElement()   X-Ref
Creates an element to add to the group
Expects the same arguments as MoodleQuickForm::createElement()


export_for_template(renderer_base $output)   X-Ref
No description

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

validateSubmitValue($values)   X-Ref
Calls the validateSubmitValue function for the containing elements and returns an error string as soon as it finds one.

param: array $values Values of the containing elements.
return: string|null Validation error message or null.