2 declare(strict_types = 1);
64 foreach ($result[
'processedTca'][
'columns'] as $columnName => $columnConfiguration) {
65 if (isset($columnConfiguration[
'config'][
'type']) && $columnConfiguration[
'config'][
'type'] ===
'flex') {
66 $flexColumns[$columnName] = $columnConfiguration;
68 if (!isset($columnConfiguration[
'displayCond'])) {
72 $columnConfiguration[
'displayCond'],
73 $result[
'databaseRow']
77 foreach ($flexColumns as $columnName => $flexColumn) {
78 $sheetNameFieldNames = [];
79 foreach ($flexColumn[
'config'][
'ds'][
'sheets'] as $sheetName => $sheetConfiguration) {
82 if (isset($sheetConfiguration[
'ROOT'][
'el']) && is_array($sheetConfiguration[
'ROOT'][
'el'])) {
83 foreach ($sheetConfiguration[
'ROOT'][
'el'] as $flexElementName => $flexElementConfiguration) {
85 if (isset($flexElementConfiguration[
'type']) && $flexElementConfiguration[
'type'] ===
'array'
86 && isset($flexElementConfiguration[
'section']) && $flexElementConfiguration[
'section'] == 1
90 $combinedKey = $sheetName .
'.' . $flexElementName;
91 if (array_key_exists($combinedKey, $sheetNameFieldNames)) {
92 throw new \RuntimeException(
93 'Ambiguous sheet name and field name combination: Sheet "' . $sheetNameFieldNames[$combinedKey][
'sheetName']
94 .
'" with field name "' . $sheetNameFieldNames[$combinedKey][
'fieldName'] .
'" overlaps with sheet "'
95 . $sheetName .
'" and field name "' . $flexElementName .
'". Do not do that.',
99 $sheetNameFieldNames[$combinedKey] = [
100 'sheetName' => $sheetName,
101 'fieldName' => $flexElementName,
106 foreach ($flexColumn[
'config'][
'ds'][
'sheets'] as $sheetName => $sheetConfiguration) {
107 if (isset($sheetConfiguration[
'ROOT'][
'displayCond'])) {
110 'context' =>
'flexSheet',
111 'sheetNameFieldNames' => $sheetNameFieldNames,
112 'currentSheetName' => $sheetName,
113 'flexFormRowData' => $result[
'databaseRow'][$columnName] ??
null,
116 $sheetConfiguration[
'ROOT'][
'displayCond'],
117 $result[
'databaseRow'],
120 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
121 [
'sheets'][$sheetName][
'ROOT'][
'displayCond']
122 = $parsedDisplayCondition;
124 if (isset($sheetConfiguration[
'ROOT'][
'el']) && is_array($sheetConfiguration[
'ROOT'][
'el'])) {
125 foreach ($sheetConfiguration[
'ROOT'][
'el'] as $flexElementName => $flexElementConfiguration) {
126 if (isset($flexElementConfiguration[
'displayCond'])) {
129 'context' =>
'flexField',
130 'sheetNameFieldNames' => $sheetNameFieldNames,
131 'currentSheetName' => $sheetName,
132 'currentFieldName' => $flexElementName,
133 'flexFormDataStructure' => $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds'],
134 'flexFormRowData' => $result[
'databaseRow'][$columnName] ??
null,
137 $flexElementConfiguration[
'displayCond'],
138 $result[
'databaseRow'],
141 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
142 [
'sheets'][$sheetName][
'ROOT']
143 [
'el'][$flexElementName][
'displayCond']
144 = $parsedDisplayCondition;
146 if (isset($flexElementConfiguration[
'type']) && $flexElementConfiguration[
'type'] ===
'array'
147 && isset($flexElementConfiguration[
'section']) && $flexElementConfiguration[
'section'] == 1
148 && isset($flexElementConfiguration[
'children']) && is_array($flexElementConfiguration[
'children'])
151 foreach ($flexElementConfiguration[
'children'] as $containerIdentifier => $containerElements) {
152 if (isset($containerElements[
'el']) && is_array($containerElements[
'el'])) {
153 foreach ($containerElements[
'el'] as $containerElementName => $containerElementConfiguration) {
154 if (isset($containerElementConfiguration[
'displayCond'])) {
156 'context' =>
'flexContainerElement',
157 'sheetNameFieldNames' => $sheetNameFieldNames,
158 'currentSheetName' => $sheetName,
159 'currentFieldName' => $flexElementName,
160 'currentContainerIdentifier' => $containerIdentifier,
161 'currentContainerElementName' => $containerElementName,
162 'flexFormDataStructure' => $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds'],
163 'flexFormRowData' => $result[
'databaseRow'][$columnName],
166 $containerElementConfiguration[
'displayCond'],
167 $result[
'databaseRow'],
170 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
171 [
'sheets'][$sheetName][
'ROOT']
172 [
'el'][$flexElementName]
173 [
'children'][$containerIdentifier]
174 [
'el'][$containerElementName][
'displayCond']
175 = $parsedDisplayCondition;
200 $conditionArray = [];
201 if (is_string($condition)) {
203 } elseif (is_array($condition)) {
204 foreach ($condition as $logicalOperator => $groupedDisplayConditions) {
205 $logicalOperator = strtoupper(is_string($logicalOperator) ? $logicalOperator :
'');
206 if (($logicalOperator !==
'AND' && $logicalOperator !==
'OR') || !is_array($groupedDisplayConditions)) {
207 throw new \RuntimeException(
208 'Multiple conditions must have boolean operator "OR" or "AND", "' . $logicalOperator .
'" given.',
213 'type' => $logicalOperator,
214 'subConditions' => [],
216 foreach ($groupedDisplayConditions as $key => $singleDisplayCondition) {
217 $key = strtoupper((
string)$key);
218 if (($key ===
'AND' || $key ===
'OR') && is_array($singleDisplayCondition)) {
221 [$key => $singleDisplayCondition],
227 $singleDisplayCondition,
235 throw new \RuntimeException(
236 'Condition must be either an array with sub conditions or a single condition string, type ' . gettype($condition) .
' given.',
240 return $conditionArray;
255 $conditionArray = GeneralUtility::trimExplode(
':', $conditionString,
false, 4);
256 $namedConditionArray = [
257 'type' => $conditionArray[0],
259 switch ($namedConditionArray[
'type']) {
261 if (empty($conditionArray[1])) {
262 throw new \RuntimeException(
263 'Field condition "' . $conditionString .
'" must have a field name as second part, none given.'
264 .
'Example: "FIELD:myField:=:myValue"',
268 $fieldName = $conditionArray[1];
269 $allowedOperators = [
'REQ',
'>',
'<',
'>=',
'<=',
'-',
'!-',
'=',
'!=',
'IN',
'!IN',
'BIT',
'!BIT'];
270 if (empty($conditionArray[2]) || !in_array($conditionArray[2], $allowedOperators)) {
271 throw new \RuntimeException(
272 'Field condition "' . $conditionString .
'" must have a valid operator as third part, non or invalid one given.'
273 .
' Valid operators are: "' . implode(
'", "', $allowedOperators) .
'".'
274 .
' Example: "FIELD:myField:=:4"',
278 $namedConditionArray[
'operator'] = $conditionArray[2];
279 if (!isset($conditionArray[3])) {
280 throw new \RuntimeException(
281 'Field condition "' . $conditionString .
'" must have an operand as fourth part, none given.'
282 .
' Example: "FIELD:myField:=:4"',
286 $operand = $conditionArray[3];
287 if ($namedConditionArray[
'operator'] ===
'REQ') {
288 $operand = strtolower($operand);
289 if ($operand ===
'true') {
290 $namedConditionArray[
'operand'] =
true;
291 } elseif ($operand ===
'false') {
292 $namedConditionArray[
'operand'] =
false;
294 throw new \RuntimeException(
295 'Field condition "' . $conditionString .
'" must have "true" or "false" as fourth part.'
296 .
' Example: "FIELD:myField:REQ:true',
300 } elseif (in_array($namedConditionArray[
'operator'], [
'>',
'<',
'>=',
'<=',
'BIT',
'!BIT'])) {
302 throw new \RuntimeException(
303 'Field condition "' . $conditionString .
'" with comparison operator ' . $namedConditionArray[
'operator']
304 .
' must have a number as fourth part, ' . $operand .
' given. Example: "FIELD:myField:>:42"',
308 $namedConditionArray[
'operand'] = (int)$operand;
309 } elseif ($namedConditionArray[
'operator'] ===
'-' || $namedConditionArray[
'operator'] ===
'!-') {
310 list($minimum, $maximum) = GeneralUtility::trimExplode(
'-', $operand);
312 throw new \RuntimeException(
313 'Field condition "' . $conditionString .
'" with comparison operator ' . $namedConditionArray[
'operator']
314 .
' must have two numbers as fourth part, separated by dash, ' . $operand .
' given. Example: "FIELD:myField:-:1-3"',
318 $namedConditionArray[
'operand'] =
'';
319 $namedConditionArray[
'min'] = (int)$minimum;
320 $namedConditionArray[
'max'] = (int)$maximum;
321 } elseif ($namedConditionArray[
'operator'] ===
'IN' || $namedConditionArray[
'operator'] ===
'!IN'
322 || $namedConditionArray[
'operator'] ===
'=' || $namedConditionArray[
'operator'] ===
'!='
324 $namedConditionArray[
'operand'] = $operand;
326 $namedConditionArray[
'fieldValue'] = $this->
findFieldValue($fieldName, $databaseRow, $flexContext);
328 case 'HIDE_FOR_NON_ADMINS':
331 if (empty($conditionArray[1]) || $conditionArray[1] !==
'NEW') {
332 throw new \RuntimeException(
333 'Record condition "' . $conditionString .
'" must contain "NEW" keyword: either "REC:NEW:true" or "REC:NEW:false"',
337 if (empty($conditionArray[2])) {
338 throw new \RuntimeException(
339 'Record condition "' . $conditionString .
'" must have an operand "true" or "false", none given. Example: "REC:NEW:true"',
343 $operand = strtolower($conditionArray[2]);
344 if ($operand ===
'true') {
345 $namedConditionArray[
'isNew'] =
true;
346 } elseif ($operand ===
'false') {
347 $namedConditionArray[
'isNew'] =
false;
349 throw new \RuntimeException(
350 'Record condition "' . $conditionString .
'" must have an operand "true" or "false, example "REC:NEW:true", given: ' . $operand,
355 if (!array_key_exists(
'uid', $databaseRow)) {
356 throw new \RuntimeException(
357 'Required [\'databaseRow\'][\'uid\'] not found in data array',
362 $namedConditionArray[
'uid'] = $databaseRow[
'uid'];
365 if (empty($conditionArray[1]) || $conditionArray[1] !==
'IS') {
366 throw new \RuntimeException(
367 'Version condition "' . $conditionString .
'" must contain "IS" keyword: either "VERSION:IS:false" or "VERSION:IS:true"',
371 if (empty($conditionArray[2])) {
372 throw new \RuntimeException(
373 'Version condition "' . $conditionString .
'" must have an operand "true" or "false", none given. Example: "VERSION:IS:true',
377 $operand = strtolower($conditionArray[2]);
378 if ($operand ===
'true') {
379 $namedConditionArray[
'isVersion'] =
true;
380 } elseif ($operand ===
'false') {
381 $namedConditionArray[
'isVersion'] =
false;
383 throw new \RuntimeException(
384 'Version condition "' . $conditionString .
'" must have a "true" or "false" operand, example "VERSION:IS:true", given: ' . $operand,
389 if (!array_key_exists(
'uid', $databaseRow)) {
390 throw new \RuntimeException(
391 'Required [\'databaseRow\'][\'uid\'] not found in data array',
395 $namedConditionArray[
'uid'] = $databaseRow[
'uid'];
396 if (array_key_exists(
'pid', $databaseRow)) {
397 $namedConditionArray[
'pid'] = $databaseRow[
'pid'];
399 if (array_key_exists(
'_ORIG_pid', $databaseRow)) {
400 $namedConditionArray[
'_ORIG_pid'] = $databaseRow[
'_ORIG_pid'];
404 if (empty($conditionArray[1])) {
405 throw new \RuntimeException(
406 'User function condition "' . $conditionString .
'" must have a user function defined a second part, none given.'
407 .
' Correct format is USER:\My\User\Func->match:more:arguments,'
408 .
' given: ' . $conditionString,
412 $namedConditionArray[
'function'] = $conditionArray[1];
413 array_shift($conditionArray);
414 array_shift($conditionArray);
415 $parameters = count($conditionArray) < 2
418 [$conditionArray[0]],
419 GeneralUtility::trimExplode(
':', $conditionArray[1])
421 $namedConditionArray[
'parameters'] = $parameters;
422 $namedConditionArray[
'record'] = $databaseRow;
423 $namedConditionArray[
'flexContext'] = $flexContext;
426 throw new \RuntimeException(
427 'Unknown condition rule type "' . $namedConditionArray[
'type'] .
'" with display condition "' . $conditionString .
'".',
431 return $namedConditionArray;
445 protected function findFieldValue(
string $givenFieldName, array $databaseRow, array $flexContext = [])
450 if (empty($flexContext)) {
451 if (array_key_exists($givenFieldName, $databaseRow)) {
452 $fieldValue = $databaseRow[$givenFieldName];
456 if ($flexContext[
'context'] ===
'flexSheet') {
460 if (strpos($givenFieldName,
'parentRec.') === 0) {
461 $fieldName = substr($givenFieldName, 10);
462 if (array_key_exists($fieldName, $databaseRow)) {
463 $fieldValue = $databaseRow[$fieldName];
466 if (array_key_exists($givenFieldName, $flexContext[
'sheetNameFieldNames'])) {
467 if ($flexContext[
'currentSheetName'] === $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'sheetName']) {
468 throw new \RuntimeException(
469 'Configuring displayCond to "' . $givenFieldName .
'" on flex form sheet "'
470 . $flexContext[
'currentSheetName'] .
'" referencing a value from the same sheet does not make sense.',
475 $sheetName = $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'sheetName'] ??
null;
476 $fieldName = $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'fieldName'] ??
null;
477 if (!isset($flexContext[
'flexFormRowData'][
'data'][$sheetName][
'lDEF'][$fieldName][
'vDEF'])) {
478 throw new \RuntimeException(
479 'Flex form displayCond on sheet "' . $flexContext[
'currentSheetName'] .
'" references field "' . $fieldName
480 .
'" of sheet "' . $sheetName .
'", but that field does not exist in current data structure',
484 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$sheetName][
'lDEF'][$fieldName][
'vDEF'];
486 } elseif ($flexContext[
'context'] ===
'flexField') {
490 if (strpos($givenFieldName,
'parentRec.') === 0) {
491 $fieldName = substr($givenFieldName, 10);
492 if (array_key_exists($fieldName, $databaseRow)) {
493 $fieldValue = $databaseRow[$fieldName];
496 $listOfLocalFlexFieldNames = array_keys(
497 $flexContext[
'flexFormDataStructure'][
'sheets'][$flexContext[
'currentSheetName']][
'ROOT'][
'el']
499 if (in_array($givenFieldName, $listOfLocalFlexFieldNames,
true)) {
501 $sheetName = $flexContext[
'currentSheetName'];
502 if (!isset($flexContext[
'flexFormRowData'][
'data'][$sheetName][
'lDEF'][$givenFieldName][
'vDEF'])) {
503 throw new \RuntimeException(
504 'Flex form displayCond on field "' . $flexContext[
'currentFieldName'] .
'" on flex form sheet "'
505 . $flexContext[
'currentSheetName'] .
'" references field "' . $givenFieldName .
'", but a field value'
506 .
' does not exist in this sheet',
510 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$sheetName][
'lDEF'][$givenFieldName][
'vDEF'];
511 } elseif (in_array($givenFieldName, array_keys($flexContext[
'sheetNameFieldNames'],
true))) {
513 $sheetName = $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'sheetName'];
514 $fieldName = $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'fieldName'];
515 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$sheetName][
'lDEF'][$fieldName][
'vDEF'];
517 throw new \RuntimeException(
518 'Flex form displayCond on field "' . $flexContext[
'currentFieldName'] .
'" on flex form sheet "'
519 . $flexContext[
'currentSheetName'] .
'" references a field or field / sheet combination "'
520 . $givenFieldName .
'" that might be defined in given data structure but is not found in data values.',
525 } elseif ($flexContext[
'context'] ===
'flexContainerElement') {
529 if (strpos($givenFieldName,
'parentRec.') === 0) {
530 $fieldName = substr($givenFieldName, 10);
531 if (array_key_exists($fieldName, $databaseRow)) {
532 $fieldValue = $databaseRow[$fieldName];
535 $currentSheetName = $flexContext[
'currentSheetName'];
536 $currentFieldName = $flexContext[
'currentFieldName'];
537 $currentContainerIdentifier = $flexContext[
'currentContainerIdentifier'];
538 $currentContainerElementName = $flexContext[
'currentContainerElementName'];
539 $listOfLocalContainerElementNames = array_keys(
540 $flexContext[
'flexFormDataStructure'][
'sheets'][$currentSheetName][
'ROOT']
541 [
'el'][$currentFieldName]
542 [
'children'][$currentContainerIdentifier]
545 $listOfLocalContainerElementNamesWithSheetName = [];
546 foreach ($listOfLocalContainerElementNames as $aContainerElementName) {
547 $listOfLocalContainerElementNamesWithSheetName[$currentSheetName .
'.' . $aContainerElementName] = [
548 'containerElementName' => $aContainerElementName,
551 $listOfLocalFlexFieldNames = array_keys(
552 $flexContext[
'flexFormDataStructure'][
'sheets'][$currentSheetName][
'ROOT'][
'el']
554 if (in_array($givenFieldName, $listOfLocalContainerElementNames,
true)) {
556 $containerType = current(array_keys(
557 $flexContext[
'flexFormRowData'][
'data'][$currentSheetName]
558 [
'lDEF'][$currentFieldName]
559 [
'el'][$currentContainerIdentifier]
561 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$currentSheetName]
562 [
'lDEF'][$currentFieldName]
563 [
'el'][$currentContainerIdentifier]
565 [
'el'][$givenFieldName][
'vDEF'];
566 } elseif (in_array($givenFieldName, array_keys($listOfLocalContainerElementNamesWithSheetName,
true))) {
568 $containerType = current(array_keys(
569 $flexContext[
'flexFormRowData'][
'data'][$currentSheetName]
570 [
'lDEF'][$currentFieldName]
571 [
'el'][$currentContainerIdentifier]
573 $fieldName = $listOfLocalContainerElementNamesWithSheetName[$givenFieldName][
'containerElementName'];
574 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$currentSheetName]
575 [
'lDEF'][$currentFieldName]
576 [
'el'][$currentContainerIdentifier]
578 [
'el'][$fieldName][
'vDEF'];
579 } elseif (in_array($givenFieldName, $listOfLocalFlexFieldNames,
true)) {
581 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$currentSheetName]
582 [
'lDEF'][$givenFieldName][
'vDEF'];
583 } elseif (in_array($givenFieldName, array_keys($flexContext[
'sheetNameFieldNames'],
true))) {
584 $sheetName = $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'sheetName'];
585 $fieldName = $flexContext[
'sheetNameFieldNames'][$givenFieldName][
'fieldName'];
586 $fieldValue = $flexContext[
'flexFormRowData'][
'data'][$sheetName][
'lDEF'][$fieldName][
'vDEF'];
588 $containerType = current(array_keys(
589 $flexContext[
'flexFormRowData'][
'data'][$currentSheetName]
590 [
'lDEF'][$currentFieldName]
591 [
'el'][$currentContainerIdentifier]
593 throw new \RuntimeException(
594 'Flex form displayCond on section container field "' . $currentContainerElementName .
'" of container type "'
595 . $containerType .
'" on flex form sheet "'
596 . $flexContext[
'currentSheetName'] .
'" references a field or field / sheet combination "'
597 . $givenFieldName .
'" that might be defined in given data structure but is not found in data values.',
617 $listOfFlexFieldNames = [];
618 foreach ($result[
'processedTca'][
'columns'] as $columnName => $columnConfiguration) {
619 $conditionResult =
true;
620 if (isset($columnConfiguration[
'displayCond'])) {
622 if (!$conditionResult) {
623 unset($result[
'processedTca'][
'columns'][$columnName]);
626 unset($result[
'processedTca'][
'columns'][$columnName][
'displayCond']);
630 if ($conditionResult && $columnConfiguration[
'config'][
'type'] ===
'flex') {
631 $listOfFlexFieldNames[] = $columnName;
636 foreach ($listOfFlexFieldNames as $columnName) {
637 $columnConfiguration = $result[
'processedTca'][
'columns'][$columnName];
638 foreach ($columnConfiguration[
'config'][
'ds'][
'sheets'] as $sheetName => $sheetConfiguration) {
639 if (isset($sheetConfiguration[
'ROOT'][
'displayCond']) && is_array($sheetConfiguration[
'ROOT'][
'displayCond'])) {
641 unset($result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds'][
'sheets'][$sheetName]);
643 unset($result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds'][
'sheets'][$sheetName][
'ROOT'][
'displayCond']);
650 $listOfFlexSectionContainers = [];
651 foreach ($listOfFlexFieldNames as $columnName) {
652 $columnConfiguration = $result[
'processedTca'][
'columns'][$columnName];
653 if (is_array($columnConfiguration[
'config'][
'ds'][
'sheets'])) {
654 foreach ($columnConfiguration[
'config'][
'ds'][
'sheets'] as $sheetName => $sheetConfiguration) {
655 if (isset($sheetConfiguration[
'ROOT'][
'el']) && is_array($sheetConfiguration[
'ROOT'][
'el'])) {
656 foreach ($sheetConfiguration[
'ROOT'][
'el'] as $flexField => $flexConfiguration) {
657 $conditionResult =
true;
658 if (isset($flexConfiguration[
'displayCond']) && is_array($flexConfiguration[
'displayCond'])) {
660 if (!$conditionResult) {
662 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
663 [
'sheets'][$sheetName][
'ROOT']
668 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
669 [
'sheets'][$sheetName][
'ROOT']
670 [
'el'][$flexField][
'displayCond']
676 && isset($flexConfiguration[
'type']) && $flexConfiguration[
'type'] ===
'array'
677 && isset($flexConfiguration[
'section']) && $flexConfiguration[
'section'] == 1
678 && isset($flexConfiguration[
'children']) && is_array($flexConfiguration[
'children'])
680 $listOfFlexSectionContainers[] = [
681 'columnName' => $columnName,
682 'sheetName' => $sheetName,
683 'flexField' => $flexField,
693 foreach ($listOfFlexSectionContainers as $flexSectionContainerPosition) {
694 $columnName = $flexSectionContainerPosition[
'columnName'];
695 $sheetName = $flexSectionContainerPosition[
'sheetName'];
696 $flexField = $flexSectionContainerPosition[
'flexField'];
697 $sectionElement = $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
698 [
'sheets'][$sheetName][
'ROOT']
700 foreach ($sectionElement[
'children'] as $containerInstanceName => $containerDataStructure) {
701 if (isset($containerDataStructure[
'el']) && is_array($containerDataStructure[
'el'])) {
702 foreach ($containerDataStructure[
'el'] as $containerElementName => $containerElementConfiguration) {
703 if (isset($containerElementConfiguration[
'displayCond']) && is_array($containerElementConfiguration[
'displayCond'])) {
706 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
707 [
'sheets'][$sheetName][
'ROOT']
709 [
'children'][$containerInstanceName]
710 [
'el'][$containerElementName]
714 $result[
'processedTca'][
'columns'][$columnName][
'config'][
'ds']
715 [
'sheets'][$sheetName][
'ROOT']
717 [
'children'][$containerInstanceName]
718 [
'el'][$containerElementName][
'displayCond']
738 switch ($conditionArray[
'type']) {
741 foreach ($conditionArray[
'subConditions'] as $subCondition) {
747 foreach ($conditionArray[
'subConditions'] as $subCondition) {
753 case 'HIDE_FOR_NON_ADMINS':
776 $operator = $condition[
'operator'];
777 $operand = $condition[
'operand'];
778 $fieldValue = $condition[
'fieldValue'];
782 if (is_array($fieldValue) && count($fieldValue) <= 1) {
783 $fieldValue = array_shift($fieldValue);
786 $result = (bool)$fieldValue;
788 $result = !$fieldValue;
792 if (is_array($fieldValue) && count($fieldValue) <= 1) {
793 $fieldValue = array_shift($fieldValue);
795 $result = $fieldValue > $operand;
798 if (is_array($fieldValue) && count($fieldValue) <= 1) {
799 $fieldValue = array_shift($fieldValue);
801 $result = $fieldValue < $operand;
804 if (is_array($fieldValue) && count($fieldValue) <= 1) {
805 $fieldValue = array_shift($fieldValue);
807 if ($fieldValue ===
null) {
812 $result = $fieldValue >= $operand;
816 if (is_array($fieldValue) && count($fieldValue) <= 1) {
817 $fieldValue = array_shift($fieldValue);
819 $result = $fieldValue <= $operand;
823 if (is_array($fieldValue) && count($fieldValue) <= 1) {
824 $fieldValue = array_shift($fieldValue);
826 $min = $condition[
'min'];
827 $max = $condition[
'max'];
828 $result = $fieldValue >= $min && $fieldValue <= $max;
829 if ($operator[0] ===
'!') {
835 if (is_array($fieldValue) && count($fieldValue) <= 1) {
836 $fieldValue = array_shift($fieldValue);
838 $result = $fieldValue == $operand;
839 if ($operator[0] ===
'!') {
845 if (is_array($fieldValue)) {
846 $result = count(array_intersect($fieldValue, GeneralUtility::trimExplode(
',', $operand))) > 0;
848 $result = GeneralUtility::inList($operand, $fieldValue);
850 if ($operator[0] ===
'!') {
856 $result = (bool)((
int)$fieldValue & $operand);
857 if ($operator[0] ===
'!') {
876 if ($condition[
'isNew']) {
877 return !((int)$condition[
'uid'] > 0);
879 return (
int)$condition[
'uid'] > 0;
890 $isNewRecord = !((int)$condition[
'uid'] > 0);
893 if ((array_key_exists(
'pid', $condition) && (
int)$condition[
'pid'] === -1)
894 || (array_key_exists(
'_ORIG_pid', $condition) && (
int)$condition[
'_ORIG_pid'] === -1)
896 $isRecordDetectedAsVersion =
true;
898 $isRecordDetectedAsVersion =
false;
904 $result = ($isUserInWorkspace || $isRecordDetectedAsVersion) && !$isNewRecord;
905 if (!$condition[
'isVersion']) {
920 'record' => $condition[
'record'],
921 'flexContext' => $condition[
'flexContext'],
922 'flexformValueKey' =>
'vDEF',
923 'conditionParameters' => $condition[
'parameters'],
925 return (
bool)GeneralUtility::callUserFunction($condition[
'function'], $parameter, $this);