34 $table = $result[
'tableName'];
36 foreach ($result[
'processedTca'][
'columns'] as $fieldName => $fieldConfig) {
37 if (empty($fieldConfig[
'config'][
'type']) || $fieldConfig[
'config'][
'type'] !==
'check') {
41 if (!is_array($fieldConfig[
'config'][
'items'])) {
42 $fieldConfig[
'config'][
'items'] = [];
45 $config = $fieldConfig[
'config'];
49 if (!empty($config[
'itemsProcFunc'])) {
52 unset($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'itemsProcFunc']);
56 if (isset($result[
'pageTsConfig'][
'TCEFORM.'][$table .
'.'][$fieldName .
'.'][
'altLabels.'])
57 && \is_array($result[
'pageTsConfig'][
'TCEFORM.'][$table .
'.'][$fieldName .
'.'][
'altLabels.'])
59 foreach ($result[
'pageTsConfig'][
'TCEFORM.'][$table .
'.'][$fieldName .
'.'][
'altLabels.'] as $itemKey => $label) {
60 if (isset($items[$itemKey][0])) {
61 $items[$itemKey][0] = $languageService->sL($label);
66 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'items'] = $items;
82 foreach ($config[
'items'] as $itemKey => $checkboxEntry) {
83 $this->
basicChecks($fieldName, $tableName, $checkboxEntry, $itemKey);
84 $newItems[$itemKey] = [
88 if (isset($config[
'renderType']) && $config[
'renderType'] ===
'checkboxToggle') {
90 } elseif (isset($config[
'renderType']) && $config[
'renderType'] ===
'checkboxLabeledToggle') {
106 private function basicChecks(
string $fieldName,
string $tableName, $checkboxEntry,
int $checkboxKey)
108 if (!\is_array($checkboxEntry)) {
109 throw new \UnexpectedValueException(
110 'Item ' . $checkboxKey .
' of field ' . $fieldName .
' of TCA table ' . $tableName .
' is not an array as expected',
114 if (!\array_key_exists(0, $checkboxEntry)) {
115 throw new \UnexpectedValueException(
116 'Item ' . $checkboxKey .
' of field ' . $fieldName .
' of TCA table ' . $tableName .
' has no label',
130 if (array_key_exists(
'invertStateDisplay', $item)) {
131 $newItems[$itemKey][
'invertStateDisplay'] = (bool)$item[
'invertStateDisplay'];
133 $newItems[$itemKey][
'invertStateDisplay'] =
false;
146 if (array_key_exists(
'labelChecked', $item)) {
149 if (array_key_exists(
'labelUnchecked', $item)) {
152 if (array_key_exists(
'invertStateDisplay', $item)) {
153 $newItems[$itemKey][
'invertStateDisplay'] = (bool)$item[
'invertStateDisplay'];
155 $newItems[$itemKey][
'invertStateDisplay'] =
false;
168 if (array_key_exists(
'iconIdentifierChecked', $item)) {
169 $newItems[$itemKey][
'iconIdentifierChecked'] = $item[
'iconIdentifierChecked'];
171 if (array_key_exists(
'iconIdentifierUnchecked', $item)) {
172 $newItems[$itemKey][
'iconIdentifierUnchecked'] = $item[
'iconIdentifierUnchecked'];
174 if (array_key_exists(
'invertStateDisplay', $item)) {
175 $newItems[$itemKey][
'invertStateDisplay'] = (bool)$item[
'invertStateDisplay'];
177 $newItems[$itemKey][
'invertStateDisplay'] =
false;