interface ExecutionMetadataStateInterface

The state used during configuration time holding data definitions.

This is mostly used for integrity checks to validate the configuration of a rule. The metadata state is passed down the expression tree where data definitions can be modified or added. Nested expression in the tree then get the updated metadata state and can make use of the updated variable data definitions.

Hierarchy

Expanded class hierarchy of ExecutionMetadataStateInterface

All classes that implement ExecutionMetadataStateInterface

6 files declare their use of ExecutionMetadataStateInterface
ActionExpression.php in src/Plugin/RulesExpression/ActionExpression.php
ConditionExpression.php in src/Plugin/RulesExpression/ConditionExpression.php
ExpressionContainerBase.php in src/Engine/ExpressionContainerBase.php
ExpressionInterface.php in src/Engine/ExpressionInterface.php
LoopExpression.php in src/Plugin/RulesExpression/LoopExpression.php

... See full list

File

src/Context/ExecutionMetadataStateInterface.php, line 17

Namespace

Drupal\rules\Context
View source
interface ExecutionMetadataStateInterface {
    
    /**
     * Creates the object.
     *
     * @param \Drupal\Core\TypedData\DataDefinitionInterface[] $data_definitions
     *   (optional) Data definitions to initialize this state with.
     *
     * @return static
     */
    public static function create(array $data_definitions = []);
    
    /**
     * Sets a data definition in the execution metadata state.
     *
     * @param string $name
     *   Variable name of the data definition.
     * @param \Drupal\Core\TypedData\DataDefinitionInterface $definition
     *   The data definition that represents the variable.
     *
     * @return $this
     */
    public function setDataDefinition($name, DataDefinitionInterface $definition);
    
    /**
     * Retrieve a data definition in this execution metadata state.
     *
     * @param string $name
     *   The variable name to get the data definition for.
     *
     * @return \Drupal\Core\TypedData\DataDefinitionInterface
     *   The data definition.
     */
    public function getDataDefinition($name);
    
    /**
     * Checks if the variable with the given name is present in the state.
     *
     * @param string $name
     *   The variable name.
     *
     * @return bool
     *   TRUE if the state has that variable, FALSE otherwise.
     */
    public function hasDataDefinition($name);
    
    /**
     * Removes a data definition from the metadata state.
     *
     * @param string $name
     *   Variable name of the data definition to be removed.
     *
     * @return $this
     */
    public function removeDataDefinition($name);
    
    /**
     * Applies a data selector and returns the corresponding data definition.
     *
     * @param string $property_path
     *   The property path, example: "node.title.value".
     * @param string $langcode
     *   The language code.
     *
     * @return \Drupal\Core\TypedData\DataDefinitionInterface
     *   A data definition if the property path could be applied.
     *
     * @throws \Drupal\rules\Exception\IntegrityException
     *   Thrown if the property path is invalid.
     */
    public function fetchDefinitionByPropertyPath($property_path, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ExecutionMetadataStateInterface::create public static function Creates the object. 1
ExecutionMetadataStateInterface::fetchDefinitionByPropertyPath public function Applies a data selector and returns the corresponding data definition. 1
ExecutionMetadataStateInterface::getDataDefinition public function Retrieve a data definition in this execution metadata state. 1
ExecutionMetadataStateInterface::hasDataDefinition public function Checks if the variable with the given name is present in the state. 1
ExecutionMetadataStateInterface::removeDataDefinition public function Removes a data definition from the metadata state. 1
ExecutionMetadataStateInterface::setDataDefinition public function Sets a data definition in the execution metadata state. 1