TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AbstractFormFieldViewHelper Class Reference
Inheritance diagram for AbstractFormFieldViewHelper:
AbstractFormViewHelper AbstractTagBasedViewHelper AbstractViewHelper ButtonViewHelper CheckboxViewHelper HiddenViewHelper PasswordViewHelper RadioViewHelper OptgroupViewHelper OptionViewHelper SelectViewHelper SubmitViewHelper TextareaViewHelper TextfieldViewHelper UploadViewHelper DatePickerViewHelper TimePickerViewHelper

Public Member Functions

 injectConfigurationManager (\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 
 initializeArguments ()
 
 getRespectSubmittedDataValue ()
 
 setRespectSubmittedDataValue ($respectSubmittedDataValue)
 
- Public Member Functions inherited from AbstractFormViewHelper
 injectPersistenceManager (\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface $persistenceManager)
 
- Public Member Functions inherited from AbstractTagBasedViewHelper
 __construct ()
 
 initializeArguments ()
 
 initialize ()
 
- Public Member Functions inherited from AbstractViewHelper
 setRenderingContext (\TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 injectReflectionService (\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
 
 prepareArguments ()
 

Protected Member Functions

 getName ()
 
 getRequest ()
 
 getNameWithoutPrefix ()
 
 getValueAttribute ()
 
 getValueFromSubmittedFormData ($value)
 
 convertToPlainValue ($value)
 
 hasMappingErrorOccurred ()
 
 getLastSubmittedFormData ()
 
 addAdditionalIdentityPropertiesIfNeeded ()
 
 getPropertyValue ()
 
 isObjectAccessorMode ()
 
 setErrorClassAttribute ()
 
 getMappingResultsForProperty ()
 
 renderHiddenFieldForEmptyValue ()
 
- Protected Member Functions inherited from AbstractFormViewHelper
 prefixFieldName ($fieldName)
 
 renderHiddenIdentityField ($object, $name)
 
 registerFieldNameForFormTokenGeneration ($fieldName)
 
- Protected Member Functions inherited from AbstractTagBasedViewHelper
 registerTagAttribute ($name, $type, $description, $required=false, $default=null)
 
 registerUniversalTagAttributes ()
 
- Protected Member Functions inherited from AbstractViewHelper
 callRenderMethod ()
 
 getLogger ()
 
 registerRenderMethodArguments ()
 

Protected Attributes

 $configurationManager
 
 $respectSubmittedDataValue = false
 
- Protected Attributes inherited from AbstractFormViewHelper
 $persistenceManager
 
- Protected Attributes inherited from AbstractTagBasedViewHelper
 $tagName = 'div'
 
 $tag
 
 $escapeOutput = false
 
- Protected Attributes inherited from AbstractViewHelper
 $controllerContext
 
 $objectManager
 

Detailed Description

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.

Definition at line 27 of file AbstractFormFieldViewHelper.php.

Member Function Documentation

addAdditionalIdentityPropertiesIfNeeded ( )
protected

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.

Returns
void

Definition at line 246 of file AbstractFormFieldViewHelper.php.

References ObjectAccess\getPropertyPath(), AbstractFormFieldViewHelper\isObjectAccessorMode(), and AbstractFormViewHelper\renderHiddenIdentityField().

Referenced by TextareaViewHelper\render(), TextfieldViewHelper\render(), PasswordViewHelper\render(), and SelectViewHelper\render().

convertToPlainValue (   $value)
protected

Converts an arbitrary value to a plain value

Parameters
mixed$valueThe value to convert
Returns
mixed

Definition at line 204 of file AbstractFormFieldViewHelper.php.

Referenced by AbstractFormFieldViewHelper\getValueAttribute(), and RadioViewHelper\render().

getLastSubmittedFormData ( )
protected

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!

Returns
mixed

Definition at line 231 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\getNameWithoutPrefix(), and ObjectAccess\getPropertyPath().

Referenced by AbstractFormFieldViewHelper\getValueFromSubmittedFormData(), RadioViewHelper\render(), and CheckboxViewHelper\render().

getMappingResultsForProperty ( )
protected

Get errors for the property and form name of this view helper

Returns
Array of errors

Definition at line 346 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\getRequest(), and AbstractFormFieldViewHelper\isObjectAccessorMode().

Referenced by UploadedResourceViewHelper\getUploadedResource(), and AbstractFormFieldViewHelper\setErrorClassAttribute().

getNameWithoutPrefix ( )
protected

Get the name of this form element, without prefix.

Returns
string name

Definition at line 114 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\isObjectAccessorMode().

Referenced by AbstractFormFieldViewHelper\getLastSubmittedFormData(), and AbstractFormFieldViewHelper\getName().

getPropertyValue ( )
protected

Get the current property of the object bound to this form.

Returns
mixed Value

Definition at line 291 of file AbstractFormFieldViewHelper.php.

References ObjectAccess\getPropertyPath().

Referenced by AbstractFormFieldViewHelper\getValueAttribute(), AbstractFormFieldViewHelper\getValueFromSubmittedFormData(), CheckboxViewHelper\render(), and RadioViewHelper\render().

getRequest ( )
protected

Shortcut for retrieving the request from the controller context

Returns

Definition at line 104 of file AbstractFormFieldViewHelper.php.

Referenced by AbstractFormFieldViewHelper\getMappingResultsForProperty().

getRespectSubmittedDataValue ( )

Getting the current configuration for respectSubmittedDataValue.

Returns
bool

Definition at line 69 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\$respectSubmittedDataValue.

getValueAttribute ( )
protected

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

Note: This method should not be used for form elements that must not change the value attribute, e.g. (radio) buttons and checkboxes.

Returns
mixed Value

Definition at line 153 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\convertToPlainValue(), AbstractFormFieldViewHelper\getPropertyValue(), AbstractFormFieldViewHelper\getValueFromSubmittedFormData(), and AbstractFormFieldViewHelper\isObjectAccessorMode().

Referenced by SelectViewHelper\getSelectedValue(), UploadedResourceViewHelper\getUploadedResource(), HiddenViewHelper\render(), TextareaViewHelper\render(), SubmitViewHelper\render(), PasswordViewHelper\render(), TextfieldViewHelper\render(), CheckboxViewHelper\render(), RadioViewHelper\render(), and ButtonViewHelper\render().

getValueFromSubmittedFormData (   $value)
protected

If property mapping errors occurred and the form is re-displayed, the last submitted value is returned by this method.

Note: This method should not be used for form elements that must not change the value attribute, e.g. (radio) buttons and checkboxes. The default behaviour is not to use this method. You need to set respectSubmittedDataValue to TRUE to enable the form data handling for the viewhelper.

Parameters
mixed$value
Returns
mixed Value

Definition at line 181 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\getLastSubmittedFormData(), AbstractFormFieldViewHelper\getPropertyValue(), AbstractFormFieldViewHelper\hasMappingErrorOccurred(), and AbstractFormFieldViewHelper\isObjectAccessorMode().

Referenced by AbstractFormFieldViewHelper\getValueAttribute().

hasMappingErrorOccurred ( )
protected

Checks if a property mapping error has occurred in the last request.

Returns
bool TRUE if a mapping error occurred, FALSE otherwise

Definition at line 220 of file AbstractFormFieldViewHelper.php.

Referenced by AbstractFormFieldViewHelper\getValueFromSubmittedFormData(), RadioViewHelper\render(), and CheckboxViewHelper\render().

initializeArguments ( )

Initialize arguments.

Returns
void

Definition at line 53 of file AbstractFormFieldViewHelper.php.

injectConfigurationManager ( \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface  $configurationManager)
Parameters
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface$configurationManager

Definition at line 42 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\$configurationManager.

isObjectAccessorMode ( )
protected

Internal method which checks if we should evaluate a domain object or just output arguments['name'] and arguments['value']

Returns
bool TRUE if we should evaluate the domain object, FALSE otherwise.

Definition at line 310 of file AbstractFormFieldViewHelper.php.

Referenced by AbstractFormFieldViewHelper\addAdditionalIdentityPropertiesIfNeeded(), AbstractFormFieldViewHelper\getMappingResultsForProperty(), AbstractFormFieldViewHelper\getNameWithoutPrefix(), AbstractFormFieldViewHelper\getValueAttribute(), and AbstractFormFieldViewHelper\getValueFromSubmittedFormData().

renderHiddenFieldForEmptyValue ( )
protected

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

Returns
string the hidden field.

Definition at line 364 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\getName().

Referenced by CheckboxViewHelper\render(), and SelectViewHelper\render().

setRespectSubmittedDataValue (   $respectSubmittedDataValue)

Define respectSubmittedDataValue to enable or disable the usage of the submitted values in the viewhelper.

Parameters
bool$respectSubmittedDataValue
Returns
void

Definition at line 80 of file AbstractFormFieldViewHelper.php.

References AbstractFormFieldViewHelper\$respectSubmittedDataValue.

Referenced by SelectViewHelper\getSelectedValue(), HiddenViewHelper\render(), TextareaViewHelper\render(), TextfieldViewHelper\render(), and PasswordViewHelper\render().

Member Data Documentation

$configurationManager
protected