TYPO3 CMS  TYPO3_7-6
RadioGroupJsonElement.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
27  public $xtype = 'typo3-form-wizard-elements-predefined-radiogroup';
28 
34  public $configuration = [
35  'attributes' => [],
36  'legend' => [
37  'value' => ''
38  ],
39  'options' => [],
40  'various' => [
41  'name' => ''
42  ],
43  'validation' => []
44  ];
45 
51  protected $allowedAttributes = [
52  'class',
53  'dir',
54  'id',
55  'lang',
56  'style'
57  ];
58 
66  public function setParameters(array $parameters)
67  {
68  parent::setParameters($parameters);
69  $this->setOptions($parameters);
70  $this->setVarious($parameters);
71  }
72 
79  protected function setOptions(array $parameters)
80  {
81  if (is_array($parameters)) {
83  foreach ($keys as $key) {
84  $class = $parameters[$key];
85  if ((int)$key && strpos($key, '.') === false) {
86  if (isset($parameters[$key . '.']) && $class === 'RADIO') {
87  $childElementArguments = $parameters[$key . '.'];
88  if (isset($childElementArguments['checked'])) {
89  $childElementArguments['attributes']['selected'] = 'selected';
90  unset($childElementArguments['checked']);
91  }
92  if (isset($childElementArguments['value'])) {
93  $childElementArguments['attributes']['value'] = $childElementArguments['value'];
94  unset($childElementArguments['value']);
95  }
96  if (isset($childElementArguments['label.'])) {
97  $childElementArguments['text'] = $childElementArguments['label.']['value'];
98  unset($childElementArguments['label.']);
99  }
100  $this->configuration['options'][] = $childElementArguments;
101  }
102  }
103  }
104  }
105  }
106 
113  protected function setVarious(array $parameters)
114  {
115  if (isset($parameters['name'])) {
116  $this->configuration['various']['name'] = $parameters['name'];
117  }
118  }
119 }
static sortedKeyList($setupArr, $acceptOnlyProperties=false)