Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Context/ContextHandlerIntegrityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
6 changes: 5 additions & 1 deletion src/Core/RulesActionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion src/Core/RulesConditionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down