function ActionExpression::checkIntegrity
Overrides ExpressionInterface::checkIntegrity
File
-
src/
Plugin/ RulesExpression/ ActionExpression.php, line 147
Class
- ActionExpression
- Provides an executable action expression.
Namespace
Drupal\rules\Plugin\RulesExpressionCode
public function checkIntegrity(ExecutionMetadataStateInterface $metadata_state, $apply_assertions = TRUE) {
$violation_list = new IntegrityViolationList();
if (empty($this->configuration['action_id'])) {
$violation_list->addViolationWithMessage($this->t('Action plugin ID is missing'), $this->getUuid());
return $violation_list;
}
if (!$this->actionManager
->hasDefinition($this->configuration['action_id'])) {
$violation_list->addViolationWithMessage($this->t('Action plugin %plugin_id does not exist', [
'%plugin_id' => $this->configuration['action_id'],
]), $this->getUuid());
return $violation_list;
}
$action = $this->actionManager
->createInstance($this->configuration['action_id']);
// Prepare and refine the context before checking integrity, such that any
// context definition changes are respected while checking.
$this->prepareContextWithMetadata($action, $metadata_state);
$result = $this->checkContextConfigIntegrity($action, $metadata_state);
$this->prepareExecutionMetadataState($metadata_state, NULL, $apply_assertions);
return $result;
}