Base functionality for all form view helpers

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

 Methods

Invoke helper as functor

__invoke(\Zend\Form\ElementInterface|null $element = null) : string | \Zend\Form\View\Helper\FormInput
Inherited

Proxies to \render().

Parameters

$element

\Zend\Form\ElementInterfacenull

Returns

string\Zend\Form\View\Helper\FormInput

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

Render a form <input> element from the provided $element

render(\Zend\Form\ElementInterface $element) : string
Inherited

Parameters

$element

\Zend\Form\ElementInterface

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

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

Determine input type to use

getType(\Zend\Form\ElementInterface $element) : string
inherited_from \Zend\Form\View\Helper\FormInput::getType()

Parameters

$element

\Zend\Form\ElementInterface

Returns

string

Determine input type to use

getType(\Zend\Form\ElementInterface $element) : string
Inherited

Parameters

$element

\Zend\Form\ElementInterface

Returns

string

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 input tag type="email"

$validTagAttributes : array

Default

array('name' => true, 'autocomplete' => true, 'autofocus' => true, 'disabled' => true, 'form' => true, 'list' => true, 'maxlength' => true, 'multiple' => true, 'pattern' => true, 'placeholder' => true, 'readonly' => true, 'required' => true, 'size' => true, 'type' => true, 'value' => true)

This should be overridden in extending classes

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

Attributes valid for the tag represented by this helper

$validTagAttributes : array

Default

array()

This should be overridden in extending classes

 

Valid values for the input type

$validTypes : array

Default

array('text' => true, 'button' => true, 'checkbox' => true, 'file' => true, 'hidden' => true, 'image' => true, 'password' => true, 'radio' => true, 'reset' => true, 'select' => true, 'submit' => true, 'color' => true, 'date' => true, 'datetime' => true, 'datetime-local' => true, 'email' => true, 'month' => true, 'number' => true, 'range' => true, 'search' => true, 'tel' => true, 'time' => true, 'url' => true, 'week' => true)
 

View object instance

$view : \Zend\View\Renderer\RendererInterface

Default

null