abstract class AbstractFormViewHelper extends AbstractTagBasedViewHelper (View source)

Abstract Form View Helper. Bundles functionality related to direct property access of objects in other Form ViewHelpers.

If you set the "property" attribute to the name of the property to resolve from the object, this class will automatically set the name and value of a form element.

Properties

protected ControllerContext $controllerContext

Controller Context to use

from  AbstractViewHelper
protected ObjectManagerInterface $objectManager from  AbstractViewHelper
protected LoggerInterface $logger from  AbstractViewHelper
protected bool $escapeOutput

Disable escaping of tag based ViewHelpers so that the rendered tag is not htmlspecialchar'd

from  AbstractTagBasedViewHelper
protected TagBuilder $tag

Tag builder instance

from  AbstractTagBasedViewHelper
protected string $tagName

Name of the tag to be created by this view helper

from  AbstractTagBasedViewHelper
protected PersistenceManagerInterface $persistenceManager

Methods

void
setRenderingContext(RenderingContextInterface $renderingContext)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

void
injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

AbstractViewHelper
registerArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Register a new argument. Call this method from your ViewHelper subclass inside the initializeArguments() method.

AbstractViewHelper
overrideArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Overrides a registered argument. Call this method from your ViewHelper subclass inside the initializeArguments() method if you want to override a previously registered argument.

void
injectTagBuilder(TagBuilder $tag)

No description

void
initialize()

Sets the tag name to $this->tagName.

void
registerTagAttribute(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null)

Register a new tag attribute. Tag attributes are all arguments which will be directly appended to a tag if you call $this->initializeTag()

void
registerUniversalTagAttributes()

Registers all standard HTML universal attributes.

void
handleAdditionalArguments(array $arguments)

Handles additional arguments, sorting out any data- prefixed tag attributes and assigning them. Then passes the unassigned arguments to the parent class' method, which in the default implementation will throw an error about "undeclared argument used".

void
injectPersistenceManager(PersistenceManagerInterface $persistenceManager)

Injects the Flow Persistence Manager

string
prefixFieldName(string $fieldName)

Prefixes / namespaces the given name with the form field prefix

string
renderHiddenIdentityField(object $object, string $name)

Renders a hidden form field containing the technical identity of the given object.

void
registerFieldNameForFormTokenGeneration(string $fieldName)

Register a field name for inclusion in the HMAC / Form Token generation

Details

void setRenderingContext(RenderingContextInterface $renderingContext)

No description

Parameters

RenderingContextInterface $renderingContext

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

Parameters

LoggerInterface $logger

Return Value

void

protected AbstractViewHelper registerArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Register a new argument. Call this method from your ViewHelper subclass inside the initializeArguments() method.

This exists only to throw our own exception!

Parameters

string $name

Name of the argument

string $type

Type of the argument

string $description

Description of the argument

bool $required

If true, argument is required. Defaults to false.

mixed $defaultValue

Default value of argument

bool|null $escape

Can be toggled to TRUE to force escaping of variables and inline syntax passed as argument value.

Return Value

AbstractViewHelper

$this, to allow chaining.

Exceptions

Exception

protected AbstractViewHelper overrideArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)

Overrides a registered argument. Call this method from your ViewHelper subclass inside the initializeArguments() method if you want to override a previously registered argument.

This exists only to throw our own exception!

Parameters

string $name

Name of the argument

string $type

Type of the argument

string $description

Description of the argument

bool $required

If true, argument is required. Defaults to false.

mixed $defaultValue

Default value of argument

bool|null $escape

Can be toggled to TRUE to force escaping of variables and inline syntax passed as argument value.

Return Value

AbstractViewHelper

$this, to allow chaining.

Exceptions

Exception

See also

registerArgument()

bool isEscapingInterceptorEnabled()

No description

Return Value

bool

__construct()

Constructor

void injectTagBuilder(TagBuilder $tag)

No description

Parameters

TagBuilder $tag

Return Value

void

void initialize()

Sets the tag name to $this->tagName.

Additionally, sets all tag attributes which were registered in $this->tagAttributes and additionalArguments.

Will be invoked just before the render method.

Return Value

void

protected void registerTagAttribute(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null)

Register a new tag attribute. Tag attributes are all arguments which will be directly appended to a tag if you call $this->initializeTag()

Parameters

string $name

Name of tag attribute

string $type

Type of the tag attribute

string $description

Description of tag attribute

bool $required

set to true if tag attribute is required. Defaults to false.

mixed $defaultValue

Optional, default value of attribute if one applies

Return Value

void

protected void registerUniversalTagAttributes()

Registers all standard HTML universal attributes.

Should be used inside registerArguments();

Return Value

void

void handleAdditionalArguments(array $arguments)

Handles additional arguments, sorting out any data- prefixed tag attributes and assigning them. Then passes the unassigned arguments to the parent class' method, which in the default implementation will throw an error about "undeclared argument used".

Parameters

array $arguments

Return Value

void

void injectPersistenceManager(PersistenceManagerInterface $persistenceManager)

Injects the Flow Persistence Manager

Parameters

PersistenceManagerInterface $persistenceManager

Return Value

void

protected string prefixFieldName(string $fieldName)

Prefixes / namespaces the given name with the form field prefix

Parameters

string $fieldName

field name to be prefixed

Return Value

string

namespaced field name

protected string renderHiddenIdentityField(object $object, string $name)

Renders a hidden form field containing the technical identity of the given object.

Parameters

object $object

Object to create the identity field for

string $name Name

Return Value

string

A hidden field containing the Identity (UUID in Flow) of the given object or NULL if the object is unknown to the persistence framework

See also

Argument::setValue

protected void registerFieldNameForFormTokenGeneration(string $fieldName)

Register a field name for inclusion in the HMAC / Form Token generation

Parameters

string $fieldName

name of the field to register

Return Value

void