function ActionExpression::executeWithState
Overrides ExpressionInterface::executeWithState
File
-
src/
Plugin/ RulesExpression/ ActionExpression.php, line 102
Class
- ActionExpression
- Provides an executable action expression.
Namespace
Drupal\rules\Plugin\RulesExpressionCode
public function executeWithState(ExecutionStateInterface $state) {
$this->rulesDebugLogger
->info('Evaluating the action %name.', [
'%name' => $this->getLabel(),
'element' => $this,
]);
$action = $this->actionManager
->createInstance($this->configuration['action_id']);
$this->prepareContext($action, $state);
$action->execute();
$auto_saves = $action->autoSaveContext();
foreach ($auto_saves as $context_name) {
// Mark parameter contexts for auto saving in the Rules state.
$state->saveChangesLater($this->configuration['context_mapping'][$context_name]);
}
// Now that the action has been executed it can provide additional
// context which we will have to pass back in the evaluation state.
$this->addProvidedContext($action, $state);
}