Base functionality for all form view helpers

package Default
inherited_from \Zend\Form\View\Helper\AbstractHelper

 Methods

Invoke helper as functor

__invoke(null|\Zend\Form\ElementInterface $element = null, null|string $labelPosition = null, boolean $renderErrors = null, string|null $partial = null) : string | \Zend\Form\View\Helper\FormRow

Proxies to \render().

Parameters

$element

null\Zend\Form\ElementInterface

$labelPosition

nullstring

$renderErrors

boolean

$partial

stringnull

Returns

string\Zend\Form\View\Helper\FormRow

Create a string of all attribute/value pairs

createAttributesString(array $attributes) : string
Inherited

Escapes all attribute values

Parameters

$attributes

array

Returns

string

Get value for doctype

getDoctype() : string
Inherited

Returns

string

Get character encoding

getEncoding() : string
Inherited

Returns

string

Get the ID of an element

getId(\Zend\Form\ElementInterface $element) : null | string
Inherited

If no ID attribute present, attempts to use the name attribute. If no name attribute is present, either, returns null.

Parameters

$element

\Zend\Form\ElementInterface

Returns

nullstring

Get the closing bracket for an inline tag

getInlineClosingBracket() : string
Inherited

Closes as either "/>" for XHTML doctypes or ">" otherwise.

Returns

string

Get the class that is added to element that have errors

getInputErrorClass() : string

Returns

string

Get the attributes for the row label

getLabelAttributes() : array

Returns

array

Get the label position

getLabelPosition() : string

Returns

string

Retrieve current partial

getPartial() : null | string

Returns

nullstring

Retrieve if the errors are rendered by this helper

getRenderErrors() : boolean

Returns

boolean

Returns translator used in helper

getTranslator() : \Zend\I18n\Translator\TranslatorInterface | null
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::getTranslator()

Returns

\Zend\I18n\Translator\TranslatorInterfacenull

Return the translation text domain

getTranslatorTextDomain() : string
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::getTranslatorTextDomain()

Returns

string

Get the view object

getView() : null | \Zend\View\Renderer\RendererInterface
Inherited
inherited_from \Zend\View\Helper\HelperInterface::getView()

Returns

null\Zend\View\Renderer\RendererInterface

Checks if the helper has a translator

hasTranslator() : boolean
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::hasTranslator()

Returns

boolean

Returns whether translator is enabled and should be used

isTranslatorEnabled() : boolean
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::isTranslatorEnabled()

Returns

boolean

Utility form helper that renders a label (if it exists), an element and errors

render(\Zend\Form\ElementInterface $element, null|string $labelPosition = null) : string

Parameters

$element

\Zend\Form\ElementInterface

$labelPosition

nullstring

Exceptions

\Zend\Form\Exception\DomainException

Returns

string

Set value for doctype

setDoctype(string $doctype) : \Zend\Form\View\Helper\AbstractHelper
Inherited

Parameters

$doctype

string

Returns

\Zend\Form\View\Helper\AbstractHelper

Set value for character encoding

setEncoding(string $encoding) : \Zend\Form\View\Helper\AbstractHelper
Inherited

Parameters

$encoding

string

Returns

\Zend\Form\View\Helper\AbstractHelper

Set the class that is added to element that have errors

setInputErrorClass(string $inputErrorClass) : \Zend\Form\View\Helper\FormRow

Parameters

$inputErrorClass

string

Returns

\Zend\Form\View\Helper\FormRow

Set the attributes for the row label

setLabelAttributes(array $labelAttributes) : \Zend\Form\View\Helper\FormRow

Parameters

$labelAttributes

array

Returns

\Zend\Form\View\Helper\FormRow

Set the label position

setLabelPosition(string $labelPosition) : \Zend\Form\View\Helper\FormRow

Parameters

$labelPosition

string

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\View\Helper\FormRow

Set a partial view script to use for rendering the row

setPartial(null|string $partial) : \Zend\Form\View\Helper\FormRow

Parameters

$partial

nullstring

Returns

\Zend\Form\View\Helper\FormRow

Set if the errors are rendered by this helper

setRenderErrors(boolean $renderErrors) : \Zend\Form\View\Helper\FormRow

Parameters

$renderErrors

boolean

Returns

\Zend\Form\View\Helper\FormRow

Sets translator to use in helper

setTranslator(\Zend\I18n\Translator\TranslatorInterface $translator = null, string $textDomain = null) : \Zend\I18n\View\Helper\AbstractTranslatorHelper
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::setTranslator()

Parameters

$translator

\Zend\I18n\Translator\TranslatorInterface

[optional] translator. Default is null, which sets no translator.

$textDomain

string

[optional] text domain Default is null, which skips setTranslatorTextDomain

Returns

\Zend\I18n\View\Helper\AbstractTranslatorHelper

Sets whether translator is enabled and should be used

setTranslatorEnabled(boolean $enabled = true) : \Zend\I18n\View\Helper\AbstractTranslatorHelper
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::setTranslatorEnabled()

Parameters

$enabled

boolean

Returns

\Zend\I18n\View\Helper\AbstractTranslatorHelper

Set translation text domain

setTranslatorTextDomain(string $textDomain = 'default') : \Zend\I18n\View\Helper\AbstractTranslatorHelper
Inherited
inherited_from \Zend\I18n\Translator\TranslatorAwareInterface::setTranslatorTextDomain()

Parameters

$textDomain

string

Returns

\Zend\I18n\View\Helper\AbstractTranslatorHelper

Set the View object

setView(\Zend\View\Renderer\RendererInterface $view) : \Zend\View\Helper\AbstractHelper
Inherited
inherited_from \Zend\View\Helper\HelperInterface::setView()

Parameters

$view

\Zend\View\Renderer\RendererInterface

Returns

\Zend\View\Helper\AbstractHelper

Retrieve the doctype helper

getDoctypeHelper() : \Zend\View\Helper\Doctype
Inherited

Returns

\Zend\View\Helper\Doctype

Retrieve the FormElementErrors helper

getElementErrorsHelper() : \Zend\Form\View\Helper\FormElementErrors

Returns

\Zend\Form\View\Helper\FormElementErrors

Retrieve the FormElement helper

getElementHelper() : \Zend\Form\View\Helper\FormElement

Returns

\Zend\Form\View\Helper\FormElement

Retrieve the escapeHtmlAttr helper

getEscapeHtmlAttrHelper() : \Zend\View\Helper\EscapeHtmlAttr
Inherited

Returns

\Zend\View\Helper\EscapeHtmlAttr

Retrieve the escapeHtml helper

getEscapeHtmlHelper() : \Zend\View\Helper\EscapeHtml
Inherited

Returns

\Zend\View\Helper\EscapeHtml

Retrieve the FormLabel helper

getLabelHelper() : \Zend\Form\View\Helper\FormLabel

Returns

\Zend\Form\View\Helper\FormLabel

Prepare attributes for rendering

prepareAttributes(array $attributes) : array
Inherited

Ensures appropriate attributes are present (e.g., if "name" is present, but no "id", sets the latter to the former).

Removes any invalid attributes

Parameters

$attributes

array

Returns

array

Prepare a boolean attribute value

prepareBooleanAttributeValue(string $attribute, mixed $value) : string
Inherited

Prepares the expected representation for the boolean attribute specified.

Parameters

$attribute

string

$value

mixed

Returns

string

 Properties

 

Standard boolean attributes, with expected values for enabling/disabling

$booleanAttributes : array

Default

array('autofocus' => array('on' => 'autofocus', 'off' => ''), 'checked' => array('on' => 'checked', 'off' => ''), 'disabled' => array('on' => 'disabled', 'off' => ''), 'multiple' => array('on' => 'multiple', 'off' => ''), 'readonly' => array('on' => 'readonly', 'off' => ''), 'required' => array('on' => 'required', 'off' => ''), 'selected' => array('on' => 'selected', 'off' => ''))
 

$doctypeHelper

$doctypeHelper : \Zend\View\Helper\Doctype

Default

 

Form element errors helper instance

$elementErrorsHelper : \Zend\Form\View\Helper\FormElementErrors

Default

 

Form element helper instance

$elementHelper : \Zend\Form\View\Helper\FormElement

Default

 

$escapeHtmlAttrHelper

$escapeHtmlAttrHelper : \Zend\View\Helper\EscapeHtmlAttr

Default

 

$escapeHtmlHelper

$escapeHtmlHelper : \Zend\View\Helper\EscapeHtml

Default

 

The class that is added to element that have errors

$inputErrorClass : string

Default

'input-error'
 

The attributes for the row label

$labelAttributes : array

Default

 

Form label helper instance

$labelHelper : \Zend\Form\View\Helper\FormLabel

Default

 

Where will be label rendered?

$labelPosition : string

Default

self::LABEL_PREPEND
 

$partial

$partial : string

Default

 

Are the errors are rendered by this helper?

$renderErrors : boolean

Default

true
 

Translatable attributes

$translatableAttributes : array

Default

array('placeholder' => true, 'title' => true)
 

Translator (optional)

$translator : \Zend\I18n\Translator\TranslatorInterface

Default

 

Whether translator should be used

$translatorEnabled : boolean

Default

true
 

Translator text domain (optional)

$translatorTextDomain : string

Default

'default'
 

Attributes globally valid for all tags

$validGlobalAttributes : array

Default

array('accesskey' => true, 'class' => true, 'contenteditable' => true, 'contextmenu' => true, 'dir' => true, 'draggable' => true, 'dropzone' => true, 'hidden' => true, 'id' => true, 'lang' => true, 'onabort' => true, 'onblur' => true, 'oncanplay' => true, 'oncanplaythrough' => true, 'onchange' => true, 'onclick' => true, 'oncontextmenu' => true, 'ondblclick' => true, 'ondrag' => true, 'ondragend' => true, 'ondragenter' => true, 'ondragleave' => true, 'ondragover' => true, 'ondragstart' => true, 'ondrop' => true, 'ondurationchange' => true, 'onemptied' => true, 'onended' => true, 'onerror' => true, 'onfocus' => true, 'oninput' => true, 'oninvalid' => true, 'onkeydown' => true, 'onkeypress' => true, 'onkeyup' => true, 'onload' => true, 'onloadeddata' => true, 'onloadedmetadata' => true, 'onloadstart' => true, 'onmousedown' => true, 'onmousemove' => true, 'onmouseout' => true, 'onmouseover' => true, 'onmouseup' => true, 'onmousewheel' => true, 'onpause' => true, 'onplay' => true, 'onplaying' => true, 'onprogress' => true, 'onratechange' => true, 'onreadystatechange' => true, 'onreset' => true, 'onscroll' => true, 'onseeked' => true, 'onseeking' => true, 'onselect' => true, 'onshow' => true, 'onstalled' => true, 'onsubmit' => true, 'onsuspend' => true, 'ontimeupdate' => true, 'onvolumechange' => true, 'onwaiting' => true, 'role' => true, 'aria-labelledby' => true, 'aria-describedby' => true, 'spellcheck' => true, 'style' => true, 'tabindex' => true, 'title' => true, 'xml:base' => true, 'xml:lang' => true, 'xml:space' => true)
 

Attributes valid for the tag represented by this helper

$validTagAttributes : array

Default

array()

This should be overridden in extending classes

 

View object instance

$view : \Zend\View\Renderer\RendererInterface

Default

null

 Constants

 

LABEL_APPEND

LABEL_APPEND = 'append' 
 

LABEL_PREPEND

LABEL_PREPEND = 'prepend'