2 declare(strict_types = 1);
41 'renderType' =>
'tcaDescription',
51 'localizationStateSelector' => [
52 'renderType' =>
'localizationStateSelector',
54 'otherLanguageContent' => [
55 'renderType' =>
'otherLanguageContent',
57 'localizationStateSelector'
60 'defaultLanguageDifferences' => [
61 'renderType' =>
'defaultLanguageDifferences',
63 'otherLanguageContent',
75 $this->iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
83 public function render(): array
89 if ($this->data[
'parameterArray'][
'fieldConf'][
'config'][
'readOnly']) {
93 $items = $this->data[
'parameterArray'][
'fieldConf'][
'config'][
'items'];
95 $numberOfItems = \count($items);
96 if ($numberOfItems === 0) {
100 $formElementValue = (int)$this->data[
'parameterArray'][
'itemFormElValue'];
101 $cols = (int)$this->data[
'parameterArray'][
'fieldConf'][
'config'][
'cols'];
104 $elementHtml .=
'<div class="checkbox-row row">';
107 foreach ($items as $itemKey => $itemDefinition) {
108 $label = $itemDefinition[0];
110 '<div class="checkbox-column ' . $colClass .
'">'
114 if ($counter < $numberOfItems && !empty($colClear)) {
115 foreach ($colClear as $rowBreakAfter => $clearClass) {
116 if ($counter % $rowBreakAfter === 0) {
117 $elementHtml .=
'<div class="clearfix ' . $clearClass .
'"></div>';
122 $elementHtml .=
'</div>';
125 foreach ($items as $itemKey => $itemDefinition) {
126 $label = $itemDefinition[0];
127 $elementHtml .= $this->
renderSingleCheckboxElement($label, $counter, $formElementValue, $numberOfItems, $this->data[
'parameterArray'], $disabled);
132 $elementHtml .=
'<input type="hidden" name="' . htmlspecialchars($this->data[
'parameterArray'][
'itemFormElName']) .
'" value="' . htmlspecialchars((
string)$formElementValue) .
'" />';
136 $fieldInformationHtml = $fieldInformationResult[
'html'];
140 $fieldWizardHtml = $fieldWizardResult[
'html'];
144 $html[] =
'<div class="formengine-field-item t3js-formengine-field-item">';
145 $html[] = $fieldInformationHtml;
146 $html[] =
'<div class="form-wizards-wrap">';
147 $html[] =
'<div class="form-wizards-element">';
148 $html[] = $elementHtml;
150 if (!$disabled && !empty($fieldWizardHtml)) {
151 $html[] =
'<div class="form-wizards-items-bottom">';
152 $html[] = $fieldWizardHtml;
158 $resultArray[
'html'] = implode(LF, $html);
173 protected function renderSingleCheckboxElement($label, $itemCounter, $formElementValue, $numberOfItems, $additionalInformation, $disabled):
string
175 $config = $additionalInformation[
'fieldConf'][
'config'];
176 $inline = !empty($config[
'cols']) && $config[
'cols'] ===
'inline';
177 $invert = isset($config[
'items'][$itemCounter][
'invertStateDisplay']) && $config[
'items'][$itemCounter][
'invertStateDisplay'] ===
true;
179 $additionalInformation[
'itemFormElName'],
183 implode(
'', $additionalInformation[
'fieldChangeFunc'])
186 $checkboxId = $additionalInformation[
'itemFormElID'] .
'_' . $itemCounter . $uniqueId;
188 $iconIdentifierChecked = !empty($config[
'items'][$itemCounter][
'iconIdentifierChecked']) ? $config[
'items'][$itemCounter][
'iconIdentifierChecked'] :
'actions-check';
189 if (!$this->iconRegistry->isRegistered($iconIdentifierChecked)) {
190 $iconIdentifierChecked =
'actions-check';
192 $iconIdentifierUnchecked = !empty($config[
'items'][$itemCounter][
'iconIdentifierUnchecked']) ? $config[
'items'][$itemCounter][
'iconIdentifierUnchecked'] :
'empty-empty';
193 if (!$this->iconRegistry->isRegistered($iconIdentifierUnchecked)) {
194 $iconIdentifierUnchecked =
'empty-empty';
196 $iconChecked = $this->iconFactory->getIcon($iconIdentifierChecked,
Icon::SIZE_SMALL)->render(
'inline');
197 $iconUnchecked = $this->iconFactory->getIcon($iconIdentifierUnchecked,
Icon::SIZE_SMALL)->render(
'inline');
200 <div class="checkbox checkbox-type-icon-toggle' . ($invert ?
' checkbox-invert' :
'') . ($inline ?
' checkbox-inline' :
'') . (!$disabled ?
'' :
' disabled') .
'">
201 <input type="checkbox"
202 class="checkbox-input"
204 data-formengine-input-name="' . htmlspecialchars($additionalInformation[
'itemFormElName']) .
'"
205 ' . $checkboxParameters .
'
206 ' . ($disabled ?
' disabled="disabled"' :
'') .
'
207 id="' . $checkboxId .
'" />
208 <label class="checkbox-label" for="' . $checkboxId .
'">
209 <span class="checkbox-label-icon">
210 <span class="checkbox-label-icon-checked">' . ($invert ? $iconUnchecked : $iconChecked) .
'</span>
211 <span class="checkbox-label-icon-unchecked">' . ($invert ? $iconChecked : $iconUnchecked) .
'</span>
213 <span class="checkbox-label-text">' . $this->
appendValueToLabelInDebugMode(($label ? htmlspecialchars($label) :
' '), $formElementValue) .
'</span>