TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter Class Reference
Inheritance diagram for TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter:
tx_form_Domain_Factory_TyposcriptToJson

Public Member Functions

 convert (array $typoscript)
 
 addElement (\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement $parentElement, $class, array $arguments)
 

Protected Member Functions

 getChildElementsByIntegerKey (\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement $parentElement, array $typoscript)
 
 setValidationRules (array $typoscript)
 
 addValidationRules (array &$arguments)
 

Protected Attributes

 $validationRules
 

Private Member Functions

 setElementType (\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement $parentElement, $class, array $arguments)
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Typoscript to JSON converter

Takes the incoming Typoscript and converts it to Json

Author
Patrick Broens patri.nosp@m.ck@p.nosp@m.atric.nosp@m.kbro.nosp@m.ens.n.nosp@m.l

Definition at line 24 of file TypoScriptToJsonConverter.php.

Member Function Documentation

◆ addElement()

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

Add child object to this element

Parameters
\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement$parentElementThe parent object
string$classType of element
array$argumentsConfiguration array
Returns
void

Definition at line 122 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 156 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
string$typoscriptTypoScript string containing all configuration for the form
Returns
string The JSON for the form

Definition at line 37 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 ( \TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement  $parentElement,
array  $typoscript 
)
protected

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

Parameters
\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement$parentElementParent model object
array$argumentsConfiguration array
Returns
void

Definition at line 77 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 ( \TYPO3\CMS\Form\Domain\Model\Json\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
\TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement$parentElementThe parent object
string$classA predefined class
array$argumentsConfiguration array
Returns
void

Definition at line 105 of file TypoScriptToJsonConverter.php.

References TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter\addElement(), and TYPO3\CMS\Form\Utility\FormUtility\getInstance().

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 140 of file TypoScriptToJsonConverter.php.

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

Member Data Documentation

◆ $validationRules

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

Definition at line 29 of file TypoScriptToJsonConverter.php.