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: 483 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

HTML_QuickForm_Renderer_Default:: (2 methods):
  __construct()
  HTML_QuickForm_Renderer_Default()

name:: (17 methods):
  toHtml()
  startForm()
  finishForm()
  renderHeader()
  _prepareTemplate()
  renderElement()
  renderHidden()
  renderHtml()
  startGroup()
  finishGroup()
  setElementTemplate()
  setGroupTemplate()
  setGroupElementTemplate()
  setHeaderTemplate()
  setFormTemplate()
  setRequiredNoteTemplate()
  clearAllTemplates()


Class: HTML_QuickForm_Renderer_Default  - X-Ref

A concrete renderer for HTML_QuickForm,
based on QuickForm 2.x built-in one

__construct()   X-Ref
Constructor


HTML_QuickForm_Renderer_Default()   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

toHtml()   X-Ref
returns the HTML generated for the form

return: string

startForm(&$form)   X-Ref
Called when visiting a form, before processing any form elements

param: object      An HTML_QuickForm object being visited
return: void

finishForm(&$form)   X-Ref
Called when visiting a form, after processing all form elements
Adds required note, form attributes, validation javascript and form content.

param: object      An HTML_QuickForm object being visited
return: void

renderHeader(&$header)   X-Ref
Called when visiting a header element

param: object     An HTML_QuickForm_header element being visited
return: void

_prepareTemplate($name, $label, $required, $error)   X-Ref
Helper method for renderElement

param: string      Element name
param: mixed       Element label (if using an array of labels, you should set the appropriate template)
param: bool        Whether an element is required
param: string      Error message associated with the element
return: string      Html for element

renderElement(&$element, $required, $error)   X-Ref
Renders an element Html
Called when visiting an element

param: object     An HTML_QuickForm_element object being visited
param: bool       Whether an element is required
param: string     An error message associated with an element
return: void

renderHidden(&$element)   X-Ref
Renders an hidden element
Called when visiting a hidden element

param: object     An HTML_QuickForm_hidden object being visited
return: void

renderHtml(&$data)   X-Ref
Called when visiting a raw HTML/text pseudo-element

param: object     An HTML_QuickForm_html element being visited
return: void

startGroup(&$group, $required, $error)   X-Ref
Called when visiting a group, before processing any group elements

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

finishGroup(&$group)   X-Ref
Called when visiting a group, after processing all group elements

param: object      An HTML_QuickForm_group object being visited
return: void

setElementTemplate($html, $element = null)   X-Ref
Sets element template

param: string      The HTML surrounding an element
param: string      (optional) Name of the element to apply template for
return: void

setGroupTemplate($html, $group)   X-Ref
Sets template for a group wrapper

This template is contained within a group-as-element template
set via setTemplate() and contains group's element templates, set
via setGroupElementTemplate()

param: string      The HTML surrounding group elements
param: string      Name of the group to apply template for
return: void

setGroupElementTemplate($html, $group)   X-Ref
Sets element template for elements within a group

param: string      The HTML surrounding an element
param: string      Name of the group to apply template for
return: void

setHeaderTemplate($html)   X-Ref
Sets header template

param: string      The HTML surrounding the header
return: void

setFormTemplate($html)   X-Ref
Sets form template

param: string    The HTML surrounding the form tags
return: void

setRequiredNoteTemplate($html)   X-Ref
Sets the note indicating required fields template

param: string      The HTML surrounding the required note
return: void

clearAllTemplates()   X-Ref
Clears all the HTML out of the templates that surround notes, elements, etc.
Useful when you want to use addData() to create a completely custom form look

return: void