TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter Class Reference

Public Member Functions

 convert (array $typoscript)
 
 addElement (AbstractJsonElement $parentElement, $class, array $arguments)
 

Protected Member Functions

 getChildElementsByIntegerKey (AbstractJsonElement $parentElement, array $typoscript)
 
 setValidationRules (array $typoscript)
 
 addValidationRules (array &$arguments)
 

Protected Attributes

 $registeredElementNames
 
 $nameMapping
 
 $validationRules
 

Private Member Functions

 setElementType (AbstractJsonElement $parentElement, $class, array $arguments)
 

Detailed Description

Typoscript to JSON converter

Takes the incoming TypoScript and converts it to JSON.

Definition at line 25 of file TypoScriptToJsonConverter.php.

Member Function Documentation

◆ addElement()

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::addElement ( AbstractJsonElement  $parentElement,
  $class,
array  $arguments 
)

Add child object to this element

Parameters
AbstractJsonElement$parentElementThe parent object
string$classType of element
array$argumentsConfiguration array
Returns
void

Definition at line 161 of file TypoScriptToJsonConverter.php.

Referenced by TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\setElementType().

◆ addValidationRules()

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::addValidationRules ( array &  $arguments)
protected

Add validation rules to an element if available

In TypoScript the validation rules belong to the form and are connected to the elements by name. However, in the wizard, they are added to the element for usability

Parameters
array$argumentsThe element arguments
Returns
void

Definition at line 197 of file TypoScriptToJsonConverter.php.

Referenced by TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\convert().

◆ convert()

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::convert ( array  $typoscript)

Convert TypoScript string to JSON

Parameters
array$typoscriptTypoScript string containing all configuration for the form
Returns
string The JSON for the form

Definition at line 68 of file TypoScriptToJsonConverter.php.

References TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\addValidationRules(), TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\getChildElementsByIntegerKey(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\setValidationRules().

◆ getChildElementsByIntegerKey()

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::getChildElementsByIntegerKey ( AbstractJsonElement  $parentElement,
array  $typoscript 
)
protected

Rendering of a "numerical array" of Form objects from TypoScript Creates new object for each element found

Parameters
AbstractJsonElement$parentElementParent model object
array$typoscriptConfiguration array
Returns
void

Definition at line 114 of file TypoScriptToJsonConverter.php.

References TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\setElementType(), and TYPO3\CMS\Core\TypoScript\TemplateService\sortedKeyList().

Referenced by TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\convert().

◆ setElementType()

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::setElementType ( AbstractJsonElement  $parentElement,
  $class,
array  $arguments 
)
private

Set the element type of the object

Checks if the typoscript object is part of the FORM or has a predefined class for name or header object

Parameters
AbstractJsonElement$parentElementThe parent object
string$classA predefined class
array$argumentsConfiguration array
Returns
void

Definition at line 143 of file TypoScriptToJsonConverter.php.

References TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\addElement().

Referenced by TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\getChildElementsByIntegerKey().

◆ setValidationRules()

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::setValidationRules ( array  $typoscript)
protected

Set the validation rules

Parameters
array$typoscriptConfiguration array
Returns
void

Definition at line 180 of file TypoScriptToJsonConverter.php.

Referenced by TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\convert().

Member Data Documentation

◆ $nameMapping

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::$nameMapping
protected
Initial value:
= [
'checkboxgroup' => 'CheckboxGroup'

Definition at line 52 of file TypoScriptToJsonConverter.php.

◆ $registeredElementNames

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::$registeredElementNames
protected
Initial value:
= [
'BUTTON',
'CHECKBOX',
'CHECKBOXGROUP',
'FIELDSET',
'FILEUPLOAD',
'HEADER',
'HIDDEN',
'IMAGEBUTTON',
'OPTGROUP',
'OPTION',
'PASSWORD',
'RADIO',
'RADIOGROUP',
'RESET',
'SELECT',
'SUBMIT',
'TEXTAREA',
'TEXTBLOCK',
'TEXTLINE'
]

Definition at line 27 of file TypoScriptToJsonConverter.php.

◆ $validationRules

TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::$validationRules
protected

Definition at line 60 of file TypoScriptToJsonConverter.php.