2 namespace TYPO3\CMS\Backend\Form\Element;
37 $parameterArray = $this->data[
'parameterArray'];
39 $config = $parameterArray[
'fieldConf'][
'config'];
40 $selectItems = $parameterArray[
'fieldConf'][
'config'][
'items'];
43 $itemArray = array_flip($parameterArray[
'itemFormElValue']);
45 $initiallySelectedIndices = [];
47 foreach ($selectItems as $i => $item) {
52 if (isset($itemArray[$value])) {
53 $attributes[
'selected'] =
'selected';
54 $initiallySelectedIndices[] = $i;
55 unset($itemArray[$value]);
59 if ((
string)$value ===
'--div--') {
60 $attributes[
'disabled'] =
'disabled';
61 $attributes[
'class'] =
'formcontrol-select-divider';
68 $resetButtonElement = $this->
renderResetButtonElement($parameterArray[
'itemFormElName'] .
'[]', $initiallySelectedIndices);
72 if (empty($config[
'readOnly'])) {
73 $html[] =
'<input type="hidden" name="' . htmlspecialchars($parameterArray[
'itemFormElName']) .
'" value="">';
78 $html = array_merge($html, [
79 '<div class="form-control-wrap" ' . ($width ?
' style="max-width: ' . $width .
'px"' :
'') .
'>',
80 '<div class="form-wizards-wrap form-wizards-aside">',
81 '<div class="form-wizards-element">',
84 '<div class="form-wizards-items">',
90 '<em>' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.holdDownCTRL',
true) .
'</em>',
93 $html = implode(LF, $html);
96 if (empty($config[
'readOnly'])) {
97 $html = $this->renderWizards(
100 $this->data[
'tableName'],
101 $this->data[
'databaseRow'],
102 $this->data[
'fieldName'],
104 $parameterArray[
'itemFormElName'],
110 $resultArray[
'html'] = $html;
125 $selectItems = $parameterArray[
'fieldConf'][
'config'][
'items'];
126 $size = (int)$config[
'size'];
127 $cssPrefix = $size === 1 ?
'tceforms-select' :
'tceforms-multiselect';
129 if ($config[
'autoSizeMax']) {
131 count($selectItems) + 1,
133 $config[
'autoSizeMax']
138 'name' => $parameterArray[
'itemFormElName'] .
'[]',
139 'multiple' =>
'multiple',
140 'onchange' => implode(
'', $parameterArray[
'fieldChangeFunc']),
142 'class' =>
'form-control ' . $cssPrefix,
146 $attributes[
'size'] = $size;
149 if ($config[
'readOnly']) {
150 $attributes[
'disabled'] =
'disabled';
153 if (isset($config[
'itemListStyle'])) {
154 $attributes[
'style'] = $config[
'itemListStyle'];
159 implode(LF, $optionElements),
163 return implode(LF, $html);
177 '<option value="' . htmlspecialchars($value) .
'" ' . $this->
implodeAttributes($attributes) .
'>',
178 htmlspecialchars($label, ENT_COMPAT,
'UTF-8',
false),
183 return implode(
'', $html);
197 'document.editform[' . $formElementName .
'].selectedIndex=-1'
199 foreach ($initiallySelectedIndices as $index) {
200 $resetCode[] =
'document.editform[' . $formElementName .
'].options[' . $index .
'].selected=1';
202 $resetCode[] =
'return false';
206 'class' =>
'btn btn-default',
207 'onclick' => htmlspecialchars(implode(
';', $resetCode)),
209 'title' => $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.revertSelection')
214 $this->iconFactory->getIcon(
'actions-edit-undo',
Icon::SIZE_SMALL)->render(),
218 return implode(
'', $html);
232 foreach ($attributes as $name => $value) {
233 $html[] = $name .
'="' . htmlspecialchars($value, ENT_COMPAT,
'UTF-8',
false) .
'"';
235 return implode(
' ', $html);