FormViewHelper
class FormViewHelper extends AbstractFormViewHelper (View source)
Used to output an HTML
Properties
protected RenderingContextInterface | $renderingContext | from AbstractViewHelper | |
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 | ||
protected PersistenceManagerInterface | $persistenceManager | from AbstractFormViewHelper | |
protected HashService | $hashService | ||
protected Context | $securityContext | ||
protected MvcPropertyMappingConfigurationService | $mvcPropertyMappingConfigurationService | ||
protected AuthenticationManagerInterface | $authenticationManager | ||
protected string|null | $formActionUri |
Methods
No description
Injects the (system) logger based on PSR-3.
Register a new tag attribute. Tag attributes are all arguments which will be directly appended to a tag if you call $this->initializeTag()
Registers all standard HTML universal attributes.
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".
Injects the Flow Persistence Manager
Prefixes / namespaces the given name with the form field prefix
Renders a hidden form field containing the technical identity of the given object.
Register a field name for inclusion in the HMAC / Form Token generation
Initialize arguments.
Render the form.
Returns the action URI of the form tag.
Render hidden form fields for query parameters from action URI.
Render additional identity fields which were registered by form elements.
Renders hidden form fields for referrer information about the current controller and action.
Adds the form object name to the ViewHelperVariableContainer if "objectName" argument or "name" attribute is specified.
Removes the form object name from the ViewHelperVariableContainer.
Returns the name of the object that is bound to this form.
Adds the object that is bound to this form to the ViewHelperVariableContainer if the formObject attribute is specified.
Removes the form object from the ViewHelperVariableContainer.
Adds the field name prefix to the ViewHelperVariableContainer
Get the field name prefix
Retrieves the default field name prefix for this form
Removes field name prefix from the ViewHelperVariableContainer
Adds a container for form field names to the ViewHelperVariableContainer
Removes the container for form field names from the ViewHelperVariableContainer
Adds a container for rendered hidden field names for empty values to the ViewHelperVariableContainer
Removes container for rendered hidden field names for empty values from ViewHelperVariableContainer
Renders all empty hidden fields that have been added to ViewHelperVariableContainer
Render the request hash field
Render the a hidden field with a CSRF token
Details
void
setRenderingContext(RenderingContextInterface $renderingContext)
No description
void
injectObjectManager(ObjectManagerInterface $objectManager)
No description
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
bool
isEscapingInterceptorEnabled()
No description
__construct()
Constructor
void
injectTagBuilder(TagBuilder $tag)
No description
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.
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()
protected void
registerUniversalTagAttributes()
Registers all standard HTML universal attributes.
Should be used inside registerArguments();
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
protected string
prefixFieldName(string $fieldName)
Prefixes / namespaces the given name with the form field prefix
protected string
renderHiddenIdentityField(object $object, string $name)
Renders a hidden form field containing the technical identity of the given object.
protected void
registerFieldNameForFormTokenGeneration(string $fieldName)
Register a field name for inclusion in the HMAC / Form Token generation
void
initializeArguments()
Initialize arguments.
string
render()
Render the form.
protected string
getFormActionUri()
Returns the action URI of the form tag.
If the argument "actionUri" is specified, this will be returned Otherwise this creates the action URI using the UriBuilder
protected string
renderHiddenActionUriQueryParameters()
Render hidden form fields for query parameters from action URI.
This is only needed if the form method is GET.
protected string
renderAdditionalIdentityFields()
Render additional identity fields which were registered by form elements.
This happens if a form field is defined like property="bla.blubb" - then we might need an identity property for the sub-object "bla".
protected string
renderHiddenReferrerFields()
Renders hidden form fields for referrer information about the current controller and action.
protected void
addFormObjectNameToViewHelperVariableContainer()
Adds the form object name to the ViewHelperVariableContainer if "objectName" argument or "name" attribute is specified.
protected void
removeFormObjectNameFromViewHelperVariableContainer()
Removes the form object name from the ViewHelperVariableContainer.
protected string|null
getFormObjectName()
Returns the name of the object that is bound to this form.
If the "objectName" argument has been specified, this is returned. Otherwise the name attribute of this form. If neither objectName nor name arguments have been set, NULL is returned.
protected void
addFormObjectToViewHelperVariableContainer()
Adds the object that is bound to this form to the ViewHelperVariableContainer if the formObject attribute is specified.
protected void
removeFormObjectFromViewHelperVariableContainer()
Removes the form object from the ViewHelperVariableContainer.
protected void
addFieldNamePrefixToViewHelperVariableContainer()
Adds the field name prefix to the ViewHelperVariableContainer
protected string
getFieldNamePrefix()
Get the field name prefix
protected string
getDefaultFieldNamePrefix()
Retrieves the default field name prefix for this form
protected void
removeFieldNamePrefixFromViewHelperVariableContainer()
Removes field name prefix from the ViewHelperVariableContainer
protected void
addFormFieldNamesToViewHelperVariableContainer()
Adds a container for form field names to the ViewHelperVariableContainer
protected void
removeFormFieldNamesFromViewHelperVariableContainer()
Removes the container for form field names from the ViewHelperVariableContainer
protected void
addEmptyHiddenFieldNamesToViewHelperVariableContainer()
Adds a container for rendered hidden field names for empty values to the ViewHelperVariableContainer
protected void
removeEmptyHiddenFieldNamesFromViewHelperVariableContainer()
Removes container for rendered hidden field names for empty values from ViewHelperVariableContainer
protected string
renderEmptyHiddenFields()
Renders all empty hidden fields that have been added to ViewHelperVariableContainer
protected string
renderTrustedPropertiesField()
Render the request hash field
protected string
renderCsrfTokenField()
Render the a hidden field with a CSRF token