Base functionality for all form view helpers

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

 Methods

Invoke helper as function

__invoke(\Zend\Form\ElementInterface|null $element = null, boolean $wrap = true) : string | \Zend\Form\View\Helper\FormCollection

Proxies to \render().

Parameters

$element

\Zend\Form\ElementInterfacenull

$wrap

boolean

Returns

string\Zend\Form\View\Helper\FormCollection

Create a string of all attribute/value pairs

createAttributesString(array $attributes) : string
Inherited

Escapes all attribute values

Parameters

$attributes

array

Returns

string

Gets the name of the view helper that should be used to render sub elements.

getDefaultElementHelper() : string

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 wrapper for the label

getLabelWrapper() : string

Returns

string

Ge the wrapper for the template

getTemplateWrapper() : string

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

Get the wrapper for the collection

getWrapper() : string

Returns

string

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 collection by iterating through all fieldsets and elements

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

Parameters

$element

\Zend\Form\ElementInterface

Returns

string

Only render a template

renderTemplate(\Zend\Form\Element\Collection $collection) : string

Parameters

$collection

\Zend\Form\Element\Collection

Returns

string

Sets the name of the view helper that should be used to render sub elements.

setDefaultElementHelper(string $defaultSubHelper) : \Zend\Form\View\Helper\FormCollection

Parameters

$defaultSubHelper

string

The name of the view helper to set.

Returns

\Zend\Form\View\Helper\FormCollection

Set value for doctype

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

Parameters

$doctype

string

Returns

\Zend\Form\View\Helper\AbstractHelper

Sets the element helper that should be used by this collection.

setElementHelper(\Zend\Form\View\Helper\AbstractHelper $elementHelper) : \Zend\Form\View\Helper\FormCollection

Parameters

$elementHelper

\Zend\Form\View\Helper\AbstractHelper

The element helper to use.

Returns

\Zend\Form\View\Helper\FormCollection

Set value for character encoding

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

Parameters

$encoding

string

Returns

\Zend\Form\View\Helper\AbstractHelper

Sets the fieldset helper that should be used by this collection.

setFieldsetHelper(\Zend\Form\View\Helper\AbstractHelper $fieldsetHelper) : \Zend\Form\View\Helper\FormCollection

Parameters

$fieldsetHelper

\Zend\Form\View\Helper\AbstractHelper

The fieldset helper to use.

Returns

\Zend\Form\View\Helper\FormCollection

Set the label-wrapper The string will be passed through sprintf with the label as single parameter This defaults to '<legend>%s</legend>'

setLabelWrapper(string $labelWrapper) : \Zend\Form\View\Helper\FormCollection
fluent This method is part of a fluent interface and will return the same instance

Parameters

$labelWrapper

string

Returns

\Zend\Form\View\Helper\FormCollection

If set to true, collections are automatically wrapped around a fieldset

setShouldWrap(boolean $wrap) : \Zend\Form\View\Helper\FormCollection

Parameters

$wrap

boolean

Returns

\Zend\Form\View\Helper\FormCollection

Set the string where the template will be inserted into

setTemplateWrapper(string $templateWrapper) : \Zend\Form\View\Helper\FormCollection

This string will be passed through sprintf and has the template as single parameter

THis defaults to ''

fluent This method is part of a fluent interface and will return the same instance

Parameters

$templateWrapper

string

Returns

\Zend\Form\View\Helper\FormCollection

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

Set the wrapper for this collection

setWrapper(string $wrapper) : \Zend\Form\View\Helper\FormCollection

The string given will be passed through sprintf with the following three replacements:

  1. The content of the collection
  2. The label of the collection. If no label is given this will be an empty string
  3. The template span-tag. This might also be an empty string

The preset default is

%2$s%1$s%3$s

fluent This method is part of a fluent interface and will return the same instance

Parameters

$wrapper

string

Returns

\Zend\Form\View\Helper\FormCollection

Get wrapped

shouldWrap() : boolean

Returns

boolean

Retrieve the doctype helper

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

Returns

\Zend\View\Helper\Doctype

Retrieve the element helper.

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

Exceptions

\RuntimeException

Returns

\Zend\Form\View\Helper\AbstractHelper

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 fieldset helper.

getFieldsetHelper() : \Zend\Form\View\Helper\FormCollection

Returns

\Zend\Form\View\Helper\FormCollection

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' => ''))
 

The name of the default view helper that is used to render sub elements.

$defaultElementHelper : string

Default

'formrow'
 

$doctypeHelper

$doctypeHelper : \Zend\View\Helper\Doctype

Default

 

The view helper used to render sub elements.

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

Default

 

$escapeHtmlAttrHelper

$escapeHtmlAttrHelper : \Zend\View\Helper\EscapeHtmlAttr

Default

 

$escapeHtmlHelper

$escapeHtmlHelper : \Zend\View\Helper\EscapeHtml

Default

 

The view helper used to render sub fieldsets.

$fieldsetHelper : \Zend\Form\View\Helper\AbstractHelper

Default

 

This is the default label-wrapper

$labelWrapper : string

Default

'%s'
 

If set to true, collections are automatically wrapped around a fieldset

$shouldWrap : boolean

Default

true
 

Where shall the template-data be inserted into

$templateWrapper : string

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

This is the default wrapper that the collection is wrapped into

$wrapper : string

Default

'%2$s%1$s%3$s'