A renderer for HTML_QuickForm

package midcom.helper.datamanager2

 Methods

__construct ($namespace)

Constructor

Parameters

$namespace

clearAllTemplates ()

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

finishForm (\HTML_QuickForm $form)

Called when visiting a form, after processing all form elements Adds required note, form attributes, validation javascript and form content.

Parameters

$form

\HTML_QuickForm&$form The object being visited

finishGroup (\HTML_QuickForm_group $group)

Called when visiting a group, after processing all group elements

Parameters

$group

\HTML_QuickForm_group&$group The object being visited

renderElement (\HTML_QuickForm_element $element, boolean $required, string $error)

Renders an element as HTML

Parameters

$element

\HTML_QuickForm_element&$element The object being visited

$required

booleanWhether an element is required

$error

stringAn error message associated with an element

renderHeader (\HTML_QuickForm_header $header)

Called when visiting a header element

Parameters

$header

\HTML_QuickForm_header&$header The element being visited

renderHidden (\HTML_QuickForm_hidden $element)

Renders a hidden element

Parameters

$element

\HTML_QuickForm_hidden&$element The object being visited

renderHtml (\HTML_QuickForm_html $data)

Called when visiting a raw HTML/text pseudo-element

Parameters

$data

\HTML_QuickForm_html&$data The element being visited

setElementTemplate (string $html, string $element)

Sets element template

Parameters

$html

stringThe HTML surrounding an element

$element

stringThe (optional) name of the element to apply template for

setFormTemplate (string $html)

Sets form template

Parameters

$html

stringThe HTML surrounding the form tags

setGroupElementTemplate (string $html, string $group)

Sets element template for elements within a group

Parameters

$html

stringThe HTML surrounding an element

$group

stringThe name of the group to apply template for

setGroupTemplate (string $html, string $group)

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()

Parameters

$html

stringThe HTML surrounding group elements

$group

stringThe name of the group to apply template for

setHeaderTemplate (string $html)

Sets header template

Parameters

$html

stringThe HTML surrounding the header

setRequiredNoteTemplate (string $html)

Sets the note indicating required fields template

Parameters

$html

stringThe HTML surrounding the required note

startForm (\HTML_QuickForm $form)

Called when visiting a form, before processing any form elements

Parameters

$form

\HTML_QuickForm&$form The object being visited

startGroup (\HTML_QuickForm_group $group, boolean $required, string $error)

Called when visiting a group, before processing any group elements

Parameters

$group

\HTML_QuickForm_group&$group The object being visited

$required

booleanWhether a group is required

$error

stringAn error message associated with a group

toHtml ()

returns the HTML generated for the form

Returns

string

_extract_helptext ($element)

Parameters

$element

_prepare_template (string $name, \HTML_Quickform_element $element, boolean $required, string $error, string $type)

Helper method for renderElement
see \renderElement()

Parameters

$name

stringElement name

$element

\HTML_Quickform_elementThe element we're working on

$required

booleanWhether an element is required

$error

stringError message associated with the element

$type

stringElement type

Returns

stringHTML for the element

_process_placeholder ($html, $identifier, $value)

Parameters

$html

$identifier

$value

_set_group_templates (string $name)

Called by start/finishGroup() to set the current template elements

Parameters

$name

stringThe group to set the templates to.

 Properties

 

string $_current_group_name

The current group running
 

array $_current_group_templates

All group templates for running groups (i.e.

prepared and ready).

 

array $_current_groups

The stack of groups
 

string $_default_group_template

Group template string
 

string $_element_template

Element template string
 

string $_form_template

Form template string
 

string $_group_element_template

Template for an element inside a group
 

array $_group_element_templates

Array containing the templates for elements in groups.
 

array $_group_elements

Array with HTML generated for group elements
 

mixed $_group_template

 

string $_group_wrap

HTML that wraps around the group elements
 

array $_group_wraps

Array containing the templates for group wraps.

These templates are wrapped around group elements and the group's own templates wrap around them. This is set by setGroupTemplate().

 

string $_header_template

Header Template string
 

string $_hidden_html

Collected HTML of the hidden fields
 

string $_html

The HTML of the form
 

boolean $_in_group

True if we are inside a group
 

string $_required_note_template

Required Note template string
 

array $_templates

Array containing the templates for customised elements