diff --git a/src/Context/ContextHandlerIntegrityTrait.php b/src/Context/ContextHandlerIntegrityTrait.php index 4a0aba22..3a7eb786 100644 --- a/src/Context/ContextHandlerIntegrityTrait.php +++ b/src/Context/ContextHandlerIntegrityTrait.php @@ -134,7 +134,10 @@ protected function checkDataTypeCompatible(CoreContextDefinitionInterface $conte $target_type = $context_definition->getDataDefinition()->getDataType(); // Special case any and entity target types for now. - if ($target_type == 'any' || ($target_type == 'entity' && strpos($provided->getDataType(), 'entity:') !== FALSE)) { + if ($target_type == 'any' || + ($target_type == 'entity' && strpos($provided->getDataType(), 'entity:') !== FALSE) || + ($target_type == 'list' && $context_definition->isMultiple()) + ) { return; } if ($target_type != $provided->getDataType()) { diff --git a/src/Core/RulesActionBase.php b/src/Core/RulesActionBase.php index 1abb8930..ad700874 100644 --- a/src/Core/RulesActionBase.php +++ b/src/Core/RulesActionBase.php @@ -121,7 +121,11 @@ public function execute() { // passing the defined context as arguments. $args = []; foreach ($this->getContextDefinitions() as $name => $definition) { - $args[$name] = $this->getContextValue($name); + $value = $this->getContextValue($name); + if ($definition->isMultiple() && !is_array($value)) { + $value = [$value]; + } + $args[$name] = $value; } call_user_func_array([$this, 'doExecute'], $args); } diff --git a/src/Core/RulesConditionBase.php b/src/Core/RulesConditionBase.php index 9deaa9af..48e52e7a 100644 --- a/src/Core/RulesConditionBase.php +++ b/src/Core/RulesConditionBase.php @@ -64,7 +64,11 @@ public function evaluate() { // passing the defined context as arguments. $args = []; foreach ($this->getContextDefinitions() as $name => $definition) { - $args[$name] = $this->getContextValue($name); + $value = $this->getContextValue($name); + if ($definition->isMultiple() && !is_array($value)) { + $value = [$value]; + } + $args[$name] = $value; } return call_user_func_array([$this, 'doEvaluate'], $args); }