TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
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 ( 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 TypoScriptToJsonConverter\setElementType().

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.

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 TypoScriptToJsonConverter\setValidationRules().

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 TypoScriptToJsonConverter\setElementType().

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 TypoScriptToJsonConverter\addElement().

Referenced by TypoScriptToJsonConverter\getChildElementsByIntegerKey().

setValidationRules ( array  $typoscript)
protected

Set the validation rules

Parameters
array$typoscriptConfiguration array
Returns
void

Definition at line 180 of file TypoScriptToJsonConverter.php.

Referenced by TypoScriptToJsonConverter\convert().

Member Data Documentation

$nameMapping
protected
Initial value:
= array(
'checkboxgroup' => 'CheckboxGroup',
'radiogroup' => 'RadioGroup',
)

Definition at line 52 of file TypoScriptToJsonConverter.php.

$registeredElementNames
protected
Initial value:
= array(
'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
protected

Definition at line 60 of file TypoScriptToJsonConverter.php.