You are here

public function ExpressionInterface::prepareExecutionMetadataState in Rules 8.3

Prepares the execution metadata state by adding metadata to it.

If this expression contains other expressions then the metadata state is set up recursively. If a $until expression is specified then the setup will stop right before that expression to calculate the state at this execution point. This is useful for inspecting the state at a certain point in the expression tree as needed during configuration, for example to do autocompletion of available variables in the state.

The difference to fully preparing the state is that not necessarily all variables are available in the middle of the expression tree, as for example variables being added later are not added yet. Preparing with $until = NULL reflects the execution metadata state at the end of the expression execution.

Parameters

\Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state: The execution metadata state, prepared until right before this expression.

\Drupal\rules\Engine\ExpressionInterface $until: (optional) The expression at which metadata preparation should be stopped. The preparation of the state will be stopped right before that expression.

bool $apply_assertions: (optional) Whether to apply metadata assertions while preparing the execution metadata state. Defaults to TRUE. Metadata assertions should be only applied if the expression's execution is required for sub-sequent expressions being executed. For example, if a condition is optional as it is part of a logical OR expression, its assertions may not be applied. Defaults to TRUE.

Return value

true|null True if the metadata has been prepared and the $until expression was found in the tree. Null otherwise.

4 methods override ExpressionInterface::prepareExecutionMetadataState()
ActionExpression::prepareExecutionMetadataState in src/Plugin/RulesExpression/ActionExpression.php
Prepares the execution metadata state by adding metadata to it.
ConditionExpression::prepareExecutionMetadataState in src/Plugin/RulesExpression/ConditionExpression.php
Prepares the execution metadata state by adding metadata to it.
ExpressionContainerBase::prepareExecutionMetadataState in src/Engine/ExpressionContainerBase.php
Prepares the execution metadata state by adding metadata to it.
RuleExpression::prepareExecutionMetadataState in src/Plugin/RulesExpression/RuleExpression.php
Prepares the execution metadata state by adding metadata to it.

File

src/Engine/ExpressionInterface.php, line 169

Class

ExpressionInterface
Defines the interface for Rules expressions.

Namespace

Drupal\rules\Engine

Code

public function prepareExecutionMetadataState(ExecutionMetadataStateInterface $metadata_state, ExpressionInterface $until = NULL, $apply_assertions = TRUE);