class FormTemplateHelper (View source)

A helper class for managing Form} and {@link FormField HTML template output.

This primarily exists to maintain backwards compatibility between Form and FormField template changes since developers may rely on specific HTML output in their applications. Any core changes to templates (such as changing ID's) may have the potential to silently prevent websites from working.

To provide a form with a custom FormTemplateHelper use the following snippet:

$form->setTemplateHelper('ClassName');

Globally, the FormTemplateHelper can be set via the Injector API.

For backwards compatibility, with < 3.2 use the FormTemplateHelper_Pre32 class which will preserve the old style form field attributes.

Injector:
  FormTemplateHelper:
    class: FormTemplateHelper_Pre32

Methods

public
string
generateFormID(Form $form)

No description

public
string
generateFieldHolderID(FormField $field)

No description

public
string
generateFieldID($field)

Generate the field ID value

Details

string generateFormID(Form $form)

No description

Parameters

Form $form

Return Value

string

string generateFieldHolderID(FormField $field)

No description

Parameters

FormField $field

Return Value

string

string generateFieldID($field)

Generate the field ID value

Parameters

$field

Return Value

string