2 namespace TYPO3\CMS\Form\Utility;
53 'checkboxgroup' =>
'CheckboxGroup',
54 'radiogroup' =>
'RadioGroup',
68 public function convert(array $typoscript)
71 $jsonObject = $this->createElement(
'form', $typoscript);
84 public function createElement($class, array $arguments = array())
86 $class = strtolower((
string)$class);
87 if (!empty($this->nameMapping[$class])) {
88 $class = $this->nameMapping[$class];
90 $className =
'TYPO3\\CMS\\Form\\Domain\\Model\Json\\' . ucfirst($class) .
'JsonElement';
93 if (!class_exists($className)) {
94 throw new \RuntimeException(
'Class "' . $className .
'" does not exist', 1440779351);
99 $object->setParameters($arguments);
100 if ($object->childElementsAllowed()) {
116 if (is_array($typoscript)) {
117 $keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($typoscript);
118 foreach ($keys as $key) {
119 $class = $typoscript[$key];
120 if ((
int)$key && strpos($key,
'.') ===
false) {
121 if (isset($typoscript[$key .
'.'])) {
122 $elementArguments = $typoscript[$key .
'.'];
124 $elementArguments = array();
145 if (in_array($class, $this->registeredElementNames)) {
146 if (strstr($arguments[
'class'],
'predefined-name')) {
149 $this->
addElement($parentElement, $class, $arguments);
164 $element = $this->createElement($class, $arguments);
165 $parentElement->addElement($element);
166 }
catch (\RuntimeException $exception) {
182 if (isset($typoscript[
'rules.']) && is_array($typoscript[
'rules.'])) {
183 $this->validationRules = $typoscript[
'rules.'];
199 if (!empty($this->validationRules) && isset($arguments[
'name'])) {
200 foreach ($this->validationRules as $key => $ruleName) {
201 if ((
int)$key && strpos($key,
'.') ===
false) {
202 if (isset($this->validationRules[$key .
'.'])) {
203 $ruleConfiguration = $this->validationRules[$key .
'.'];
204 if (isset($ruleConfiguration[
'element']) && $ruleConfiguration[
'element'] === $arguments[
'name']) {
205 $arguments[
'validation'][$ruleName] = $ruleConfiguration;