TextareaViewHelper
class TextareaViewHelper extends AbstractFormFieldViewHelper (View source)
Textarea view helper.
The value of the text area needs to be set via the "value" attribute, as with all other form ViewHelpers.
= Examples =
<output>
<textarea name="myTextArea">This is shown inside the textarea</textarea>
</output>
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 | ||
protected PersistenceManagerInterface | $persistenceManager | from AbstractFormViewHelper |
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 the arguments.
Shortcut for retrieving the request from the controller context
Get the name of this form element, without prefix.
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
Checks if a property mapping error has occurred in the last request.
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!
Add additional identity properties in case the current property is hierarchical (of the form "bla.blubb").
Get the current property of the object bound to this form.
Returns the "absolute" property path of the property bound to this ViewHelper.
Internal method which checks if we should evaluate a domain object or just output arguments['name'] and arguments['value']
Add an CSS class if this view helper has errors
Get errors for the property and form name of this view helper
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
Renders the textarea.
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
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 textarea.