You are here

interface ContextAwarePluginInterface in Rules 8.3

Rules extension of ContextAwarePluginInterface.

Hierarchy

Expanded class hierarchy of ContextAwarePluginInterface

All classes that implement ContextAwarePluginInterface

2 files declare their use of ContextAwarePluginInterface
RulesActionInterface.php in src/Core/RulesActionInterface.php
RulesConditionInterface.php in src/Core/RulesConditionInterface.php

File

src/Context/ContextAwarePluginInterface.php, line 10

Namespace

Drupal\rules\Context
View source
interface ContextAwarePluginInterface extends CoreContextAwarePluginInterface {

  /**
   * Refines used and provided context definitions based upon context values.
   *
   * When a plugin is configured half-way or even fully, some context values are
   * already available upon which the definition of subsequent or provided
   * context can be refined.
   *
   * Implement this method, when the plugin's context definitions need to be
   * refined. When the selected data definitions should be refined, implement
   * ::assertMetadata() instead.
   *
   * Note that context gets refined at configuration and execution time of the
   * plugin.
   *
   * @param \Drupal\Core\TypedData\DataDefinitionInterface[] $selected_data
   *   An array of data definitions for context that is mapped using a data
   *   selector, keyed by context name.
   */
  public function refineContextDefinitions(array $selected_data);

  /**
   * Asserts additional metadata for the selected data.
   *
   * Allows the plugin to assert additional metadata that is in place when the
   * plugin has been successfully executed. A typical use-case would be
   * asserting the node type for a "Node is of type" condition. By doing so,
   * sub-sequent executed plugins are aware of the metadata and can build upon
   * it.
   *
   * Implement this method, when the selected data definitions need to be
   * refined. When the plugin's context definitions should be refined, implement
   * ::refineContextDefinitions() instead.
   *
   * Note that metadata is only asserted on configuration time. The plugin has
   * to ensure that the run-time data matches the asserted configuration if it
   * has been executed successfully.
   *
   * @param \Drupal\Core\TypedData\DataDefinitionInterface[] $selected_data
   *   An array of data definitions for context that is mapped using a data
   *   selector, keyed by context name.
   *
   * @return \Drupal\Core\TypedData\DataDefinitionInterface[]
   *   An array of modified data definitions, keyed as the passed array. Note
   *   data definitions need to be cloned *before* they are modified, such that
   *   the changes do not propagate unintentionally.
   */
  public function assertMetadata(array $selected_data);

}

Members

Namesort descending Modifiers Type Description Overrides
ContextAwarePluginInterface::assertMetadata public function Asserts additional metadata for the selected data. 2
ContextAwarePluginInterface::getContext public function Gets a defined context. 1
ContextAwarePluginInterface::getContextDefinition public function Gets a specific context definition of the plugin. Overrides ContextAwarePluginInterface::getContextDefinition
ContextAwarePluginInterface::getContextDefinitions public function Gets the context definitions of the plugin. Overrides ContextAwarePluginInterface::getContextDefinitions
ContextAwarePluginInterface::getContextMapping public function Gets a mapping of the expected assignment names to their context names. 1
ContextAwarePluginInterface::getContexts public function Gets the defined contexts. 1
ContextAwarePluginInterface::getContextValue public function Gets the value for a defined context. 1
ContextAwarePluginInterface::getContextValues public function Gets the values for all defined contexts. 1
ContextAwarePluginInterface::refineContextDefinitions public function Refines used and provided context definitions based upon context values. 2
ContextAwarePluginInterface::setContext public function Set a context on this plugin. 1
ContextAwarePluginInterface::setContextMapping public function Sets a mapping of the expected assignment names to their context names. 1
ContextAwarePluginInterface::setContextValue public function Sets the value for a defined context. 1
ContextAwarePluginInterface::validateContexts public function Validates the set values for the defined contexts. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2