‪TYPO3CMS  11.5
TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper:
TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper TYPO3\CMS\Form\ViewHelpers\FormViewHelper

Public Member Functions

 injectHashService (HashService $hashService)
 
 injectMvcPropertyMappingConfigurationService (MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService)
 
 injectExtensionService (ExtensionService $extensionService)
 
 initializeArguments ()
 
string render ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper
 injectPersistenceManager (PersistenceManagerInterface $persistenceManager)
 

Protected Member Functions

 setFormActionUri ()
 
string renderAdditionalIdentityFields ()
 
string renderHiddenReferrerFields ()
 
 addFormObjectNameToViewHelperVariableContainer ()
 
 removeFormObjectNameFromViewHelperVariableContainer ()
 
string getFormObjectName ()
 
 addFormObjectToViewHelperVariableContainer ()
 
 removeFormObjectFromViewHelperVariableContainer ()
 
 addFieldNamePrefixToViewHelperVariableContainer ()
 
string getFieldNamePrefix ()
 
 removeFieldNamePrefixFromViewHelperVariableContainer ()
 
 addFormFieldNamesToViewHelperVariableContainer ()
 
 removeFormFieldNamesFromViewHelperVariableContainer ()
 
 postProcessUriArgumentsForRequestHash ($arguments, &$results, $currentPrefix='', $level=0)
 
string getDefaultFieldNamePrefix ()
 
 removeCheckboxFieldNamesFromViewHelperVariableContainer ()
 
string renderTrustedPropertiesField ()
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper
string prefixFieldName ($fieldName)
 
string renderHiddenIdentityField ($object, $name)
 
 registerFieldNameForFormTokenGeneration ($fieldName)
 

Protected Attributes

string $tagName = 'form'
 
TYPO3 CMS Extbase Security Cryptography HashService $hashService
 
TYPO3 CMS Extbase Mvc Controller MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService
 
TYPO3 CMS Extbase Service ExtensionService $extensionService
 
array $formActionUriArguments
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper
TYPO3 CMS Extbase Persistence PersistenceManagerInterface $persistenceManager
 

Detailed Description

Form ViewHelper. Generates a :html:<form> Tag.

Basic usage

Use :html:<f:form> to output an HTML :html:<form> tag which is targeted at the specified action, in the current controller and package. It will submit the form data via a POST request. If you want to change this, use :html:method="get" as an argument.

Examples

A complex form with a specified encoding type

Form with enctype set::

<f:form action=".." controller="..." package="..." enctype="multipart/form-data">...</f:form>

A Form which should render a domain object

Binding a domain object to a form::

<f:form action="..." name="customer" object="{customer}"> <f:form.hidden property="id" /> <f:form.textarea property="name" /> </f:form>

This automatically inserts the value of {customer.name} inside the textarea and adjusts the name of the textarea accordingly.

Definition at line 59 of file FormViewHelper.php.

Member Function Documentation

◆ addFieldNamePrefixToViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::addFieldNamePrefixToViewHelperVariableContainer ( )
protected

Adds the field name prefix to the ViewHelperVariableContainer

Definition at line 350 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\getFieldNamePrefix().

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ addFormFieldNamesToViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::addFormFieldNamesToViewHelperVariableContainer ( )
protected

Adds a container for form field names to the ViewHelperVariableContainer

Definition at line 380 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ addFormObjectNameToViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::addFormObjectNameToViewHelperVariableContainer ( )
protected

Adds the form object name to the ViewHelperVariableContainer if "objectName" argument or "name" attribute is specified.

Definition at line 286 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\getFormObjectName().

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ addFormObjectToViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::addFormObjectToViewHelperVariableContainer ( )
protected

Adds the object that is bound to this form to the ViewHelperVariableContainer if the formObject attribute is specified.

Definition at line 326 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ getDefaultFieldNamePrefix()

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::getDefaultFieldNamePrefix ( )
protected

Retrieves the default field name prefix for this form

Returns
‪string default field name prefix

Definition at line 424 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\getFieldNamePrefix().

◆ getFieldNamePrefix()

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::getFieldNamePrefix ( )
protected

◆ getFormObjectName()

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::getFormObjectName ( )
protected

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.

Returns
‪string specified Form name or NULL if neither $objectName nor $name arguments have been specified

Reimplemented in TYPO3\CMS\Form\ViewHelpers\FormViewHelper.

Definition at line 312 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\addFormObjectNameToViewHelperVariableContainer(), TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\removeFormObjectNameFromViewHelperVariableContainer(), and TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::initializeArguments ( )

Initialize arguments.

Definition at line 111 of file FormViewHelper.php.

◆ injectExtensionService()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::injectExtensionService ( ExtensionService  $extensionService)
Parameters
\TYPO3\CMS\Extbase\Service\ExtensionService$extensionService

Definition at line 103 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\$extensionService.

◆ injectHashService()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::injectHashService ( HashService  $hashService)
Parameters
\TYPO3\CMS\Extbase\Security\Cryptography\HashService$hashService

Definition at line 87 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\$hashService.

◆ injectMvcPropertyMappingConfigurationService()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::injectMvcPropertyMappingConfigurationService ( MvcPropertyMappingConfigurationService  $mvcPropertyMappingConfigurationService)
Parameters
\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService$mvcPropertyMappingConfigurationService

Definition at line 95 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\$mvcPropertyMappingConfigurationService.

◆ postProcessUriArgumentsForRequestHash()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::postProcessUriArgumentsForRequestHash (   $arguments,
$results,
  $currentPrefix = '',
  $level = 0 
)
protected

Add the URI arguments after postprocessing to the request hash as well.

Parameters
array$arguments
array$results
string$currentPrefix
int$level

Definition at line 404 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\FormViewHelperTest\postProcessUriArgumentsForRequestHashWorks().

◆ removeCheckboxFieldNamesFromViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::removeCheckboxFieldNamesFromViewHelperVariableContainer ( )
protected

Remove Checkbox field names from ViewHelper variable container, to start from scratch when a new form starts.

Definition at line 446 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ removeFieldNamePrefixFromViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::removeFieldNamePrefixFromViewHelperVariableContainer ( )
protected

Removes field name prefix from the ViewHelperVariableContainer

Definition at line 372 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ removeFormFieldNamesFromViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::removeFormFieldNamesFromViewHelperVariableContainer ( )
protected

Removes the container for form field names from the ViewHelperVariableContainer

Definition at line 388 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ removeFormObjectFromViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::removeFormObjectFromViewHelperVariableContainer ( )
protected

Removes the form object from the ViewHelperVariableContainer.

Definition at line 338 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ removeFormObjectNameFromViewHelperVariableContainer()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::removeFormObjectNameFromViewHelperVariableContainer ( )
protected

Removes the form name from the ViewHelperVariableContainer.

Definition at line 297 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\getFormObjectName().

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ render()

◆ renderAdditionalIdentityFields()

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::renderAdditionalIdentityFields ( )
protected

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".

Returns
‪string HTML-string for the additional identity properties

Definition at line 239 of file FormViewHelper.php.

References $output.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ renderHiddenReferrerFields()

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::renderHiddenReferrerFields ( )
protected

Renders hidden form fields for referrer information about the current controller and action.

Returns
‪string Hidden fields with referrer information
Todo:
‪filter out referrer information that is equal to the target (e.g. same packageKey)

Reimplemented in TYPO3\CMS\Form\ViewHelpers\FormViewHelper.

Definition at line 260 of file FormViewHelper.php.

References TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper\prefixFieldName().

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

◆ renderTrustedPropertiesField()

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::renderTrustedPropertiesField ( )
protected

◆ setFormActionUri()

TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::setFormActionUri ( )
protected

Sets the "action" attribute of the form tag

Definition at line 195 of file FormViewHelper.php.

Referenced by TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper\render().

Member Data Documentation

◆ $extensionService

TYPO3 CMS Extbase Service ExtensionService TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::$extensionService
protected

◆ $formActionUriArguments

array TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::$formActionUriArguments
protected

We need the arguments of the formActionUri on requesthash calculation therefore we will store them in here right after calling uriBuilder

Definition at line 82 of file FormViewHelper.php.

◆ $hashService

TYPO3 CMS Extbase Security Cryptography HashService TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::$hashService
protected

◆ $mvcPropertyMappingConfigurationService

TYPO3 CMS Extbase Mvc Controller MvcPropertyMappingConfigurationService TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::$mvcPropertyMappingConfigurationService
protected

◆ $tagName

string TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::$tagName = 'form'
protected

Definition at line 63 of file FormViewHelper.php.