2 namespace TYPO3\CMS\Backend\Form\FormDataProvider;
43 $this->processedTca = $result[
'processedTca'];
45 $recordTypeValue = $result[
'recordTypeValue'];
48 if (!empty($result[
'processedTca'][
'types'][$recordTypeValue][
'subtype_value_field'])) {
49 $subtypeFieldName = $result[
'processedTca'][
'types'][$recordTypeValue][
'subtype_value_field'];
50 if (array_key_exists($subtypeFieldName, $result[
'databaseRow'])) {
51 $subtypeValue = $result[
'databaseRow'][$subtypeFieldName];
58 if (!empty($result[
'processedTca'][
'types'][$recordTypeValue][
'bitmask_value_field'])
59 && isset($result[
'processedTca'][
'types'][$recordTypeValue][
'bitmask_excludelist_bits'])
60 && is_array($result[
'processedTca'][
'types'][$recordTypeValue][
'bitmask_excludelist_bits'])
62 $bitmaskFieldName = $result[
'processedTca'][
'types'][$recordTypeValue][
'bitmask_value_field'];
63 if (array_key_exists($bitmaskFieldName, $result[
'databaseRow'])) {
64 $bitmaskValue = $result[
'databaseRow'][$bitmaskFieldName];
71 unset($result[
'processedTca'][
'types'][$recordTypeValue][
'subtype_value_field']);
72 unset($result[
'processedTca'][
'types'][$recordTypeValue][
'subtypes_excludelist']);
73 unset($result[
'processedTca'][
'types'][$recordTypeValue][
'subtypes_addlist']);
74 unset($result[
'processedTca'][
'types'][$recordTypeValue][
'bitmask_value_field']);
75 unset($result[
'processedTca'][
'types'][$recordTypeValue][
'bitmask_excludelist_bits']);
98 if (!empty($this->processedTca[
'types'][$recordTypeValue][
'subtypes_addlist'][$subtypeValue])
99 && is_string($this->processedTca[
'types'][$recordTypeValue][
'subtypes_addlist'][$subtypeValue])
101 $addListString = $this->processedTca[
'types'][$recordTypeValue][
'subtypes_addlist'][$subtypeValue];
103 $showItemFieldString = $result[
'processedTca'][
'types'][$recordTypeValue][
'showitem'];
106 foreach ($showItemFieldArray as $index => $fieldConfigurationString) {
109 $fieldName = $fieldConfigurationArray[0];
110 if ($fieldName === $subtypeFieldName) {
113 }
elseif ($fieldName ===
'--palette--') {
115 if (isset($fieldConfigurationArray[2])) {
116 $paletteName = $fieldConfigurationArray[2];
117 if (!empty($this->processedTca[
'palettes'][$paletteName][
'showitem'])) {
119 foreach ($paletteFields as $paletteFieldConfiguration) {
121 if ($paletteFieldConfigurationArray[0] === $subtypeFieldName) {
132 array_splice($showItemFieldArray, $index + 1, 0, $addListArray);
136 $result[
'processedTca'][
'types'][$recordTypeValue][
'showitem'] = implode(
',', $showItemFieldArray);
158 if (!empty($this->processedTca[
'types'][$recordTypeValue][
'subtypes_excludelist'][$subtypeValue])
159 && is_string($this->processedTca[
'types'][$recordTypeValue][
'subtypes_excludelist'][$subtypeValue])
161 $removeListString = $this->processedTca[
'types'][$recordTypeValue][
'subtypes_excludelist'][$subtypeValue];
163 $result = $this->
removeFields($result, $removeListArray, $recordTypeValue);
186 $removeListArray = array();
188 $excludeListBitsArray = $this->processedTca[
'types'][$recordTypeValue][
'bitmask_excludelist_bits'];
189 foreach ($excludeListBitsArray as $bitKey => $excludeList) {
190 $bitKey = (int)$bitKey;
191 $isNegative = (bool)($bitKey < 0);
193 if (!$isNegative && ($bitmaskValue & pow(2, $bit))
194 || $isNegative && !($bitmaskValue & pow(2, $bit))
199 $result = $this->
removeFields($result, $removeListArray, $recordTypeValue);
211 protected function removeFields(array $result, array $removeListArray, $recordTypeValue)
213 $newFieldList = array();
214 $showItemFieldString = $result[
'processedTca'][
'types'][$recordTypeValue][
'showitem'];
216 foreach ($showItemFieldArray as $fieldConfigurationString) {
218 $fieldName = $fieldConfigurationArray[0];
219 if (!in_array($fieldConfigurationArray[0], $removeListArray,
true)
221 || $fieldName ===
'--palette--' || $fieldName ===
'--div--'
223 $newFieldList[] = $fieldConfigurationString;
226 $result[
'processedTca'][
'types'][$recordTypeValue][
'showitem'] = implode(
',', $newFieldList);
240 if (isset($result[
'processedTca'][
'palettes']) && is_array($result[
'processedTca'][
'palettes'])) {
241 foreach ($result[
'processedTca'][
'palettes'] as $paletteName => $paletteArray) {
242 if (!isset($paletteArray[
'showitem']) || !is_string($paletteArray[
'showitem'])) {
243 throw new \UnexpectedValueException(
244 'showitem field of palette ' . $paletteName .
' in table ' . $result[
'tableName'] .
' not found or not a string',
248 $showItemFieldString = $paletteArray[
'showitem'];
250 $newFieldList = array();
251 foreach ($showItemFieldArray as $fieldConfigurationString) {
253 $fieldName = $fieldConfigurationArray[0];
254 if (!in_array($fieldConfigurationArray[0], $removeListArray,
true)
255 || $fieldName ===
'--linebreak--'
257 $newFieldList[] = $fieldConfigurationString;
260 $result[
'processedTca'][
'palettes'][$paletteName][
'showitem'] = implode(
',', $newFieldList);