ECA content: the condition to compare field values doesn't work correctly with boolean fields

Issue information

From user: jurgenhaas

Contribution record

Fork management

Problem/Motivation

When comparing a boolean field (e.g. the field in_draft in webform submissions) with something (usually "0" or "1"), that always fails because \Drupal\eca_content\Plugin\ECA\Condition\EntityFieldValue::getFieldValues always returns an empty value for boolean fields.

The reason for that is that the property is a \Drupal\Core\TypedData\Plugin\DataType\BooleanData and that return a boolean which gets casted to string with this:

<?php
if ($property instanceof PrimitiveInterface) {
 
$values[] = (string) $property->getValue();
}
?>

Proposed resolution

For boolean data, let's cats to integer first and then cast to string.

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information