Base functionality for all form view helpers

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

 Methods

Generate a form label, optionally with content

__invoke(\Zend\Form\ElementInterface $element = null, null|string $labelContent = null, string $position = null) : string | \Zend\Form\View\Helper\FormLabel

Always generates a "for" statement, as we cannot assume the form input will be provided in the $labelContent.

Parameters

$element

\Zend\Form\ElementInterface

$labelContent

nullstring

$position

string

Exceptions

\Zend\Form\Exception\DomainException

Returns

string\Zend\Form\View\Helper\FormLabel

Return a closing label tag

closeTag() : string

Returns

string

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

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

Generate an opening label tag

openTag(null|array|\Zend\Form\ElementInterface $attributesOrElement = null) : string

Parameters

$attributesOrElement

nullarray\Zend\Form\ElementInterface

Exceptions

\Zend\Form\Exception\InvalidArgumentException
\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

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

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

 

$escapeHtmlAttrHelper

$escapeHtmlAttrHelper : \Zend\View\Helper\EscapeHtmlAttr

Default

 

$escapeHtmlHelper

$escapeHtmlHelper : \Zend\View\Helper\EscapeHtml

Default

 

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 label tag

$validTagAttributes : array

Default

array('for' => true, 'form' => true)

This should be overridden in extending classes

inherited_from \Zend\Form\View\Helper\AbstractHelper::validTagAttributes
 

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

 

APPEND

APPEND = 'append' 
 

PREPEND

PREPEND = 'prepend'