Bug #89304

DisplayCond with field sys_language_uid on pages records not working

Added by Oliver Bartsch 20 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2019-09-29
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
DisplayCond, sys_language_uid
Complexity:
Is Regression:
Sprint Focus:

Description

I encountered a problem using displayCond with sys_language_uid on pages fields.
When I use FIELD:sys_language_uid:=:0 to show a field only if it’s the default page record the field doesn’t get displayed at all (default or localizations).
If I use :<=:0 or :<:1 it’s working. This is just the case for pages records. The same dispayCond is working for e.g. tt_content.

It seems that this happens because $result['databaseRow']['sys_language_uid] is an empty array due to an empty items array in $result['processedTca'] which gets processed in TcaSelectItems.

Here is the relevant part which evaluates the DisplayCond with the corresponding values:

$operand = '='; // used operand in the DisplayCond
$fieldValue = []; // this is the value of sys_language_uid in this case

// Relevant evaluation in EvaluateDisplayConditions
if (is_array($fieldValue) && count($fieldValue) <= 1) {
    $fieldValue = array_shift($fieldValue);
}
$result = $fieldValue == $operand;

var_dump($result); // bool(false)

Also available in: Atom PDF