function RulesConditionBase::evaluate
Overrides ConditionInterface::evaluate
5 methods override RulesConditionBase::evaluate()
- DataIsEmpty::evaluate in src/
Plugin/ Condition/ DataIsEmpty.php - Evaluates the condition and returns TRUE or FALSE accordingly.
- TestConditionFalse::evaluate in tests/
modules/ rules_test/ src/ Plugin/ Condition/ TestConditionFalse.php - Evaluates the condition and returns TRUE or FALSE accordingly.
- TestConditionProvider::evaluate in tests/
modules/ rules_test/ src/ Plugin/ Condition/ TestConditionProvider.php - Evaluates the condition and returns TRUE or FALSE accordingly.
- TestConditionTrue::evaluate in tests/
modules/ rules_test/ src/ Plugin/ Condition/ TestConditionTrue.php - Evaluates the condition and returns TRUE or FALSE accordingly.
- TestTextCondition::evaluate in tests/
modules/ rules_test/ src/ Plugin/ Condition/ TestTextCondition.php - Evaluates the condition and returns TRUE or FALSE accordingly.
File
-
src/
Core/ RulesConditionBase.php, line 63
Class
- RulesConditionBase
- Base class for rules conditions.
Namespace
Drupal\rules\CoreCode
public function evaluate() {
// Provide a reasonable default implementation that calls doEvaluate() while
// passing the defined context as arguments.
$args = [];
foreach ($this->getContextDefinitions() as $name => $definition) {
$value = $this->getContextValue($name);
$type = $definition->toArray()['type'];
if (substr($type, 0, 6) == 'entity') {
if (is_array($value) && is_string($value[0])) {
$value = array_map([
$this,
'upcastEntityId',
], $value, array_fill(0, count($value), $type));
}
elseif (is_string($value)) {
$value = $this->upcastEntityId($value, $type);
}
}
$args[$name] = $value;
}
return call_user_func_array([
$this,
'doEvaluate',
], $args);
}