You are here

public function ConditionExpressionContainer::executeWithState in Rules 8.3

Execute the expression with a given Rules state.

Note that this does not auto-save any changes.

Parameters

\Drupal\rules\Context\ExecutionStateInterface $state: The state with all the execution variables in it.

Return value

null|bool The expression may return a boolean value after execution, this is used by conditions that return their evaluation result.

Throws

\Drupal\rules\Exception\EvaluationException Thrown if the Rules expression triggers errors during execution.

Overrides ExpressionInterface::executeWithState

File

src/Engine/ConditionExpressionContainer.php, line 78

Class

ConditionExpressionContainer
Container for conditions.

Namespace

Drupal\rules\Engine

Code

public function executeWithState(ExecutionStateInterface $rules_state) {
  $result = $this
    ->evaluate($rules_state);
  return $this
    ->isNegated() ? !$result : $result;
}