Legend of the Green Dragon

FormBitField extends FormSelect

Base functionality for all form view helpers.

Table of Contents

$booleanAttributes  : array<string|int, mixed>
Standard boolean attributes, with expected values for enabling/disabling.
$defaultTranslatableHtmlAttributePrefixes  : array<string|int, mixed>
The default translatable HTML attribute prefixes.
$defaultTranslatableHtmlAttributes  : array<string|int, mixed>
The default translatable HTML attributes.
$escapeHtmlAttrHelper  : EscapeHtmlAttr
$formHiddenHelper  : FormHidden|null
$lotgdKernel  : mixed
$lotgdKernelContainer  : mixed
$lotgdSymfonyTranslator  : mixed
$lotgdTranslator  : mixed
$serviceManager  : mixed
$translatableAttributePrefixes  : array<string|int, mixed>
Prefixes of translatable HTML attributes.
$translatableAttributes  : array<string|int, mixed>
Translatable attributes.
$translatorTextDomain  : string
Translation text domain.
$validGlobalAttributes  : array<string|int, mixed>
Attributes globally valid for all tags.
$validOptgroupAttributes  : array<string|int, mixed>
Attributes valid for option groups.
$validOptionAttributes  : array<string|int, mixed>
Attributes valid for options.
$validSelectAttributes  : array<string|int, mixed>
Attributes valid for select.
$validTagAttributePrefixes  : array<string|int, mixed>
Attribute prefixes valid for all tags.
$validTagAttributes  : array<string|int, mixed>
Attributes valid for the tag represented by this helper.
addDefaultTranslatableAttribute()  : mixed
Adds an HTML attribute to the list of the default translatable attributes.
addDefaultTranslatableAttributePrefix()  : mixed
Adds an HTML attribute to the list of translatable attributes.
addTranslatableAttribute()  : AbstractHelper
Adds an HTML attribute to the list of translatable attributes.
addTranslatableAttributePrefix()  : AbstractHelper
Adds an HTML attribute to the list of translatable attributes.
addValidAttribute()  : AbstractHelper
Adds an HTML attribute to the list of valid attributes.
addValidAttributePrefix()  : AbstractHelper
Adds a prefix to the list of valid attribute prefixes.
createAttributesString()  : string
Create a string of all attribute/value pairs.
getContainer()  : object
Get container.
getFunctions()  : mixed
{@inheritdoc}
getId()  : string|null
Get the ID of an element.
getKernel()  : Kernel
Get LoTGD Kernel.
getName()  : mixed
{@inheritdoc}
getService()  : mixed
Get container.
getTranslator()  : object|null
Get translator instance.
getTranslatorTextDomain()  : string
Return the translation text domain.
messageFormatter()  : string
Only format a message with MessageFormatter.
render()  : string
Render a form <select> element from the provided $element.
renderOptgroup()  : string
Render an optgroup.
renderOptions()  : string
Render an array of options.
setContainer()  : mixed
Set container (Service Manager).
setTranslatorTextDomain()  : $this
Set translation text domain.
symfonyTranslator()  : Translator
Symfony Translator instance.
bitFieldValues()  : array<string|int, mixed>
Format bitfield values as array.
getEscapeHtmlAttrHelper()  : EscapeHtmlAttr
Retrieve the escapeHtmlAttr helper.
getFormHiddenHelper()  : FormHidden
hasAllowedPrefix()  : bool
Whether the passed attribute has a valid prefix or not.
isValidAttributeName()  : bool
Whether the passed attribute is valid or not.
prepareAttributes()  : array<string|int, mixed>
Prepare attributes for rendering.
prepareBooleanAttributeValue()  : string
Prepare a boolean attribute value.
renderHiddenElement()  : mixed
translateHtmlAttributeValue()  : string
Translates the value of the HTML attribute if it should be translated and this view helper has a translator.
validateMultiValue()  : array<string|int, mixed>
Ensure that the value is set appropriately.
cleanParameters()  : bool
Clean param of a value.

Properties

$booleanAttributes

Standard boolean attributes, with expected values for enabling/disabling.

protected array<string|int, mixed> $booleanAttributes = ['autocomplete' => ['on' => 'on', 'off' => 'off'], 'autofocus' => ['on' => 'autofocus', 'off' => ''], 'checked' => ['on' => 'checked', 'off' => ''], 'disabled' => ['on' => 'disabled', 'off' => ''], 'multiple' => ['on' => 'multiple', 'off' => ''], 'readonly' => ['on' => 'readonly', 'off' => ''], 'required' => ['on' => 'required', 'off' => ''], 'selected' => ['on' => 'selected', 'off' => '']]

$defaultTranslatableHtmlAttributePrefixes

The default translatable HTML attribute prefixes.

protected static array<string|int, mixed> $defaultTranslatableHtmlAttributePrefixes = []

$defaultTranslatableHtmlAttributes

The default translatable HTML attributes.

protected static array<string|int, mixed> $defaultTranslatableHtmlAttributes = ['title' => true]

$escapeHtmlAttrHelper

protected EscapeHtmlAttr $escapeHtmlAttrHelper

$formHiddenHelper

protected FormHidden|null $formHiddenHelper

$lotgdKernelContainer

protected mixed $lotgdKernelContainer

$lotgdSymfonyTranslator

protected mixed $lotgdSymfonyTranslator

$lotgdTranslator

protected mixed $lotgdTranslator

$serviceManager

protected mixed $serviceManager

$translatableAttributePrefixes

Prefixes of translatable HTML attributes.

protected array<string|int, mixed> $translatableAttributePrefixes = []

$translatableAttributes

Translatable attributes.

protected array<string|int, mixed> $translatableAttributes = ['placeholder' => true]

$translatorTextDomain

Translation text domain.

protected string $translatorTextDomain = 'default'

$validGlobalAttributes

Attributes globally valid for all tags.

protected array<string|int, mixed> $validGlobalAttributes = ['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, 'spellcheck' => true, 'style' => true, 'tabindex' => true, 'title' => true, 'xml:base' => true, 'xml:lang' => true, 'xml:space' => true]

$validOptgroupAttributes

Attributes valid for option groups.

protected array<string|int, mixed> $validOptgroupAttributes = ['disabled' => true, 'label' => true]

$validOptionAttributes

Attributes valid for options.

protected array<string|int, mixed> $validOptionAttributes = ['disabled' => true, 'selected' => true, 'label' => true, 'value' => true]

$validSelectAttributes

Attributes valid for select.

protected array<string|int, mixed> $validSelectAttributes = ['name' => true, 'autocomplete' => true, 'autofocus' => true, 'disabled' => true, 'form' => true, 'multiple' => true, 'required' => true, 'size' => true]

$validTagAttributePrefixes

Attribute prefixes valid for all tags.

protected array<string|int, mixed> $validTagAttributePrefixes = ['data-', 'aria-', 'x-']

$validTagAttributes

Attributes valid for the tag represented by this helper.

protected array<string|int, mixed> $validTagAttributes = []

This should be overridden in extending classes

Methods

addDefaultTranslatableAttribute()

Adds an HTML attribute to the list of the default translatable attributes.

public static addDefaultTranslatableAttribute(string $attribute) : mixed
Parameters
$attribute : string
Return values
mixed

addDefaultTranslatableAttributePrefix()

Adds an HTML attribute to the list of translatable attributes.

public static addDefaultTranslatableAttributePrefix(string $prefix) : mixed
Parameters
$prefix : string
Return values
mixed

addTranslatableAttribute()

Adds an HTML attribute to the list of translatable attributes.

public addTranslatableAttribute(string $attribute) : AbstractHelper
Parameters
$attribute : string
Return values
AbstractHelper

addTranslatableAttributePrefix()

Adds an HTML attribute to the list of translatable attributes.

public addTranslatableAttributePrefix(string $prefix) : AbstractHelper
Parameters
$prefix : string
Return values
AbstractHelper

addValidAttribute()

Adds an HTML attribute to the list of valid attributes.

public addValidAttribute(string $attribute) : AbstractHelper
Parameters
$attribute : string
Tags
throws
InvalidArgumentException

for attribute names that are invalid per the HTML specifications

Return values
AbstractHelper

addValidAttributePrefix()

Adds a prefix to the list of valid attribute prefixes.

public addValidAttributePrefix(string $prefix) : AbstractHelper
Parameters
$prefix : string
Tags
throws
InvalidArgumentException

for attribute prefixes that are invalid per the HTML specifications for attribute names

Return values
AbstractHelper

createAttributesString()

Create a string of all attribute/value pairs.

public createAttributesString(Environment $env, array<string|int, mixed> $attributes) : string

Escapes all attribute values

Parameters
$env : Environment
$attributes : array<string|int, mixed>
Return values
string

getContainer()

Get container.

public getContainer([string $name = null ]) : object
Parameters
$name : string = null
Tags
deprecated
4.10.0
Return values
object

getFunctions()

{@inheritdoc}

public getFunctions() : mixed
Return values
mixed

getId()

Get the ID of an element.

public getId(ElementInterface $element) : string|null

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

Parameters
$element : ElementInterface
Return values
string|null

getName()

{@inheritdoc}

public getName() : mixed
Return values
mixed

getService()

Get container.

public getService(string $name) : mixed
Parameters
$name : string
Return values
mixed

getTranslator()

Get translator instance.

public getTranslator() : object|null
Return values
object|null

getTranslatorTextDomain()

Return the translation text domain.

public getTranslatorTextDomain() : string
Return values
string

messageFormatter()

Only format a message with MessageFormatter.

public messageFormatter(string $message[, array<string|int, mixed>|null $parameters = [] ][, string|null $locale = null ]) : string
Parameters
$message : string
$parameters : array<string|int, mixed>|null = []
$locale : string|null = null
Return values
string

render()

Render a form <select> element from the provided $element.

public render(Environment $env, ElementInterface $element) : string
Parameters
$env : Environment
$element : ElementInterface
Tags
throws
InvalidArgumentException
throws
DomainException
Return values
string

renderOptgroup()

Render an optgroup.

public renderOptgroup(mixed $env, array<string|int, mixed> $optgroup[, array<string|int, mixed> $selectedOptions = [] ]) : string

See for the options specification. Basically, an optgroup is simply an option that has an additional "options" key with an array following the specification for renderOptions().

Parameters
$env : mixed
$optgroup : array<string|int, mixed>
$selectedOptions : array<string|int, mixed> = []
Return values
string

renderOptions()

Render an array of options.

public renderOptions(mixed $env, array<string|int, mixed> $options[, array<string|int, mixed> $selectedOptions = [] ]) : string

Individual options should be of the form:

array( 'value' => 'value', 'label' => 'label', 'disabled' => $booleanFlag, 'selected' => $booleanFlag, )
Parameters
$env : mixed
$options : array<string|int, mixed>
$selectedOptions : array<string|int, mixed> = []

Option values that should be marked as selected

Return values
string

setContainer()

Set container (Service Manager).

public setContainer(ContainerInterface $container) : mixed
Parameters
$container : ContainerInterface
Tags
deprecated
4.10.0
Return values
mixed

setTranslatorTextDomain()

Set translation text domain.

public setTranslatorTextDomain([string $textDomain = 'default' ]) : $this
Parameters
$textDomain : string = 'default'
Return values
$this

symfonyTranslator()

Symfony Translator instance.

public symfonyTranslator() : Translator
Return values
Translator

bitFieldValues()

Format bitfield values as array.

protected bitFieldValues(mixed $value, array<string|int, mixed> $disableMask) : array<string|int, mixed>
Parameters
$value : mixed
$disableMask : array<string|int, mixed>
Return values
array<string|int, mixed>

getEscapeHtmlAttrHelper()

Retrieve the escapeHtmlAttr helper.

protected getEscapeHtmlAttrHelper() : EscapeHtmlAttr
Return values
EscapeHtmlAttr

getFormHiddenHelper()

protected getFormHiddenHelper() : FormHidden
Return values
FormHidden

hasAllowedPrefix()

Whether the passed attribute has a valid prefix or not.

protected hasAllowedPrefix(string $attribute) : bool
Parameters
$attribute : string
Return values
bool

prepareAttributes()

Prepare attributes for rendering.

protected prepareAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>

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<string|int, mixed>
Return values
array<string|int, mixed>

prepareBooleanAttributeValue()

Prepare a boolean attribute value.

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

Prepares the expected representation for the boolean attribute specified.

Parameters
$attribute : string
$value : mixed
Return values
string

renderHiddenElement()

protected renderHiddenElement(ElementInterface $element) : mixed
Parameters
$element : ElementInterface
Return values
mixed

translateHtmlAttributeValue()

Translates the value of the HTML attribute if it should be translated and this view helper has a translator.

protected translateHtmlAttributeValue(Environment $env, string $key, string $value) : string
Parameters
$env : Environment
$key : string
$value : string
Return values
string

validateMultiValue()

Ensure that the value is set appropriately.

protected validateMultiValue(mixed $value, array<string|int, mixed> $attributes) : array<string|int, mixed>

If the element's value attribute is an array, but there is no multiple attribute, or that attribute does not evaluate to true, then we have a domain issue -- you cannot have multiple options selected unless the multiple attribute is present and enabled.

Parameters
$value : mixed
$attributes : array<string|int, mixed>
Tags
throws
DomainException
Return values
array<string|int, mixed>

cleanParameters()

Clean param of a value.

private cleanParameters(mixed $param) : bool
Parameters
$param : mixed
Return values
bool

Search results