interface ContextProviderInterface in Rules 8.3
Interface for plugins that provide context.
This interface allows plugins to provide new context; e.g., an action plugin that loads a user would provide the user entity.
The plugin has to specify an array of context definitions for the provided context under the "provides" key at the plugin definition, keyed by provided context name.
Hierarchy
- interface \Drupal\rules\Context\ContextProviderInterface
Expanded class hierarchy of ContextProviderInterface
All classes that implement ContextProviderInterface
3 files declare their use of ContextProviderInterface
- ContextHandlerIntegrityTrait.php in src/
Context/ ContextHandlerIntegrityTrait.php - RulesActionInterface.php in src/
Core/ RulesActionInterface.php - RulesConditionInterface.php in src/
Core/ RulesConditionInterface.php
File
- src/
Context/ ContextProviderInterface.php, line 15
Namespace
Drupal\rules\ContextView source
interface ContextProviderInterface {
/**
* Sets the value for a provided context.
*
* @param string $name
* The name of the provided context in the plugin definition.
* @param mixed $value
* The value to set the provided context to.
*
* @return $this
*/
public function setProvidedValue($name, $value);
/**
* Gets a defined provided context.
*
* @param string $name
* The name of the provided context in the plugin definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested provided context is not set.
*
* @return \Drupal\Core\Plugin\Context\ContextInterface
* The context object.
*/
public function getProvidedContext($name);
/**
* Gets a specific provided context definition of the plugin.
*
* @param string $name
* The name of the provided context in the plugin definition.
*
* @throws \Drupal\Component\Plugin\Exception\PluginException
* If the requested provided context is not defined.
*
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
* The definition of the provided context.
*/
public function getProvidedContextDefinition($name);
/**
* Gets the provided context definitions of the plugin.
*
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface[]
* The array of provided context definitions, keyed by context name.
*/
public function getProvidedContextDefinitions();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContextProviderInterface:: |
public | function | Gets a defined provided context. | |
ContextProviderInterface:: |
public | function | Gets a specific provided context definition of the plugin. | |
ContextProviderInterface:: |
public | function | Gets the provided context definitions of the plugin. | |
ContextProviderInterface:: |
public | function | Sets the value for a provided context. |