TYPO3
7.6
|
Public Member Functions | |
setConfiguration (Configuration $configuration) | |
renderItem ($configuration, $type=null, $defaultMessage= '') | |
sanitizeNameAttribute ($name) | |
sanitizeIdAttribute ($id) | |
Static Public Member Functions | |
static | getObjectManager () |
Protected Attributes | |
$configuration | |
A utility for the form
Definition at line 23 of file FormUtility.php.
|
static |
renderItem | ( | $configuration, | |
$type = null , |
|||
$defaultMessage = '' |
|||
) |
Render TypoScript values There are different variants. It is possible that the TypoScript which we want to render looks like this:
array( 'message' => 'TEXT', 'message.' => array( 'value' => 'blah' ) )
or in "short syntax" (the wizard writes some syntax partly)
array( 'message.' => array( 'value' => 'blah' ) )
or it is simply a string.
Furthermore we have 2 modes:
This method will take care of all scenarios and provide some fallbacks. Call this method always in the following way:
renderItem( $typoscript['itemToRender.'], $typoscript['itemToRender'], $optionalDefaultMessage )
You dont have to handle if is $typoscript['itemToRender.'] is set or not. This function determines this. This allows us to get the value of a TypoScript construct without knowing about "short syntax", only a string, a cObject, if cObject rendering is allowed and so on.
If contentelement rendering is allowed: If $type and $configuration are set render as an cObject.
If $type is set but $configuration is empty only return the value of $type.
If $type is empty and $configuration is an array ("short syntax") render the $configuration as content type TEXT.
If $type is empty and $configuration is a string render the value of $configuration like 10 = TEXT 10.value = $configuration.
If $type is empty and $configuration is empty return the $defaultMessage.
If contentelement rendering is not allowed: If $type is set but $configuration is empty only return the value of $type.
If $type is set and $configuration['value'] isset return the value of $configuration['value'].
If $type is set and $configuration['value'] is not set return the value of $defaultMessage.
If $type is empty and $configuration['value'] isset return the value of $configuration['value'].
If $type is empty and $configuration['value'] is not set return the value of $defaultMessage.
mixed | $configuration | a string or a TypoScript array |
NULL | string | $type | cObject type or simply a string value |
string | $defaultMessage |
Definition at line 130 of file FormUtility.php.
References FormUtility\$configuration, and $GLOBALS.
sanitizeIdAttribute | ( | $id | ) |
If the id is not defined it is automatically generated using the following syntax: field-{element_counter} The id attribute will be transformed if it contains some non allowed characters:
string | $id |
Definition at line 232 of file FormUtility.php.
sanitizeNameAttribute | ( | $name | ) |
If the name is not defined it is automatically generated using the following syntax: id-{element_counter} The name attribute will be transformed if it contains some non allowed characters:
string | $name |
Definition at line 209 of file FormUtility.php.
setConfiguration | ( | Configuration | $configuration | ) |
Configuration | $configuration |
Definition at line 45 of file FormUtility.php.
References FormUtility\$configuration.
|
protected |
Definition at line 40 of file FormUtility.php.
Referenced by FormUtility\renderItem(), and FormUtility\setConfiguration().