TYPO3 CMS  TYPO3_7-6
SelectJsonElement.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-basic-select';
28 
34  public $configuration = [
35  'attributes' => [],
36  'filters' => [],
37  'label' => [
38  'value' => ''
39  ],
40  'layout' => 'front',
41  'options' => [],
42  'validation' => []
43  ];
44 
50  protected $allowedAttributes = [
51  'accesskey',
52  'class',
53  'contenteditable',
54  'contextmenu',
55  'dir',
56  'draggable',
57  'dropzone',
58  'hidden',
59  'id',
60  'lang',
61  'spellcheck',
62  'style',
63  'tabindex',
64  'title',
65  'translate',
66  /* element specific attributes */
67  'autofocus',
68  'disabled',
69  'multiple',
70  'name',
71  'required',
72  'size'
73  ];
74 
75  protected $childElementsAllowed = false;
76 
84  public function setParameters(array $parameters)
85  {
86  parent::setParameters($parameters);
87  $this->setOptions($parameters);
88  }
89 
96  protected function setOptions(array $parameters)
97  {
98  if (is_array($parameters)) {
100  foreach ($keys as $key) {
101  $class = $parameters[$key];
102  if ((int)$key && strpos($key, '.') === false) {
103  if (isset($parameters[$key . '.']) && $class === 'OPTION') {
104  $childElementArguments = $parameters[$key . '.'];
105  if (isset($childElementArguments['selected'])) {
106  $childElementArguments['attributes']['selected'] = $childElementArguments['selected'];
107  unset($childElementArguments['selected']);
108  }
109  if (isset($childElementArguments['value'])) {
110  $childElementArguments['attributes']['value'] = $childElementArguments['value'];
111  unset($childElementArguments['value']);
112  }
113  if (isset($childElementArguments['data']) && !isset($childElementArguments['text'])) {
114  // preserve backward compatibility by rewriting data to text
115  $childElementArguments['text'] = $childElementArguments['data'];
116  }
117  $this->configuration['options'][] = $childElementArguments;
118  }
119  }
120  }
121  }
122  }
123 }
static sortedKeyList($setupArr, $acceptOnlyProperties=false)