SubmitViewHelper
class SubmitViewHelper extends AbstractFormFieldViewHelper (View source)
Creates a submit button.
= Examples =
<output>
<input type="submit" />
</output>
<code title="Dummy content for template preview">
<f:form.submit name="mySubmit" value="Send Mail"><button>dummy button</button></f:form.submit>
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
Methods
void
setRenderingContext(RenderingContextInterface $renderingContext)
No description
from
AbstractViewHelper
void
from
AbstractViewHelper
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
from
AbstractViewHelper
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
void
initializeArguments()
Initialize the arguments.
getRequest()
Shortcut for retrieving the request from the controller context
string
getNameWithoutPrefix()
Get the name of this form element, without prefix.
mixed
getValueAttribute(bool $ignoreSubmittedFormData = false)
Returns the current value of this Form ViewHelper and converts it to an identifier string in case it's an object
The value is determined as follows:
- If property mapping errors occurred and the form is re-displayed, the last submitted value is returned
- Else the bound property is returned (only in objectAccessor-mode)
- As fallback the "value" argument of this ViewHelper is used
bool
hasMappingErrorOccurred()
Checks if a property mapping error has occurred in the last request.
mixed
getLastSubmittedFormData()
Get the form data which has last been submitted; only returns valid data in case
a property mapping error has occurred. Check with hasMappingErrorOccurred() before!
void
addAdditionalIdentityPropertiesIfNeeded()
Add additional identity properties in case the current property is hierarchical (of the form "bla.blubb").
mixed
getPropertyValue()
Get the current property of the object bound to this form.
string
getPropertyPath()
Returns the "absolute" property path of the property bound to this ViewHelper.
bool
isObjectAccessorMode()
Internal method which checks if we should evaluate a domain object or just output arguments['name'] and arguments['value']
void
setErrorClassAttribute()
Add an CSS class if this view helper has errors
getMappingResultsForProperty()
Get errors for the property and form name of this view helper
void
renderHiddenFieldForEmptyValue()
Renders a hidden field with the same name as the element, to make sure the empty value is submitted
in case nothing is selected. This is needed for checkbox and multiple select fields
string
render()
Renders the submit button.
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 the arguments.
protected string
getName()
Get the name of this form element.
Either returns arguments['name'], or the correct name for Object Access.
In case property is something like bla.blubb (hierarchical), then [bla][blubb] is generated.
protected ActionRequest
getRequest()
Shortcut for retrieving the request from the controller context
protected string
getNameWithoutPrefix()
Get the name of this form element, without prefix.
protected mixed
getValueAttribute(bool $ignoreSubmittedFormData = false)
Returns the current value of this Form ViewHelper and converts it to an identifier string in case it's an object
The value is determined as follows:
- If property mapping errors occurred and the form is re-displayed, the last submitted value is returned
- Else the bound property is returned (only in objectAccessor-mode)
- As fallback the "value" argument of this ViewHelper is used
protected bool
hasMappingErrorOccurred()
Checks if a property mapping error has occurred in the last request.
protected mixed
getLastSubmittedFormData()
Get the form data which has last been submitted; only returns valid data in case
a property mapping error has occurred. Check with hasMappingErrorOccurred() before!
protected void
addAdditionalIdentityPropertiesIfNeeded()
Add additional identity properties in case the current property is hierarchical (of the form "bla.blubb").
Then, [bla][__identity] has to be generated as well.
protected mixed
getPropertyValue()
Get the current property of the object bound to this form.
protected string
getPropertyPath()
Returns the "absolute" property path of the property bound to this ViewHelper.
For this will be ".foo.bar"
For this will be "foo.bar.baz"
protected bool
isObjectAccessorMode()
Internal method which checks if we should evaluate a domain object or just output arguments['name'] and arguments['value']
protected void
setErrorClassAttribute()
Add an CSS class if this view helper has errors
protected Result
getMappingResultsForProperty()
Get errors for the property and form name of this view helper
protected void
renderHiddenFieldForEmptyValue()
Renders a hidden field with the same name as the element, to make sure the empty value is submitted
in case nothing is selected. This is needed for checkbox and multiple select fields
string
render()
Renders the submit button.