You are here

interface PluginContextDefinitionInterface in Plugin 8.2

Defines a plugin definition that includes contexts.

Hierarchy

Expanded class hierarchy of PluginContextDefinitionInterface

All classes that implement PluginContextDefinitionInterface

File

src/PluginDefinition/PluginContextDefinitionInterface.php, line 12

Namespace

Drupal\plugin\PluginDefinition
View source
interface PluginContextDefinitionInterface extends PluginDefinitionInterface {

  /**
   * Sets the context definitions.
   *
   * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface[] $context_definitions
   *   The array of context definitions, keyed by context name.
   *
   * @return $this
   *
   * @throws \InvalidArgumentException
   *   Thrown if the definitions are invalid.
   */
  public function setContextDefinitions(array $context_definitions);

  /**
   * Gets the context definitions.
   *
   * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface[]
   *   The array of context definitions, keyed by context name.
   */
  public function getContextDefinitions();

  /**
   * Sets a specific context definition.
   *
   * @param string $name
   *   The name of the context in the plugin definition.
   * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $context_definition
   *   The context definition to set.
   *
   * @return $this
   */
  public function setContextDefinition($name, ContextDefinitionInterface $context_definition);

  /**
   * Gets a specific context definition.
   *
   * @param string $name
   *   The name of the context in the plugin definition.
   *
   * @throws \InvalidArgumentException
   *   If the requested context does not exist.
   *
   * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
   *
   * @see self::hasContextDefinition()
   */
  public function getContextDefinition($name);

  /**
   * Checks if a specific context definition exists.
   *
   * @param string $name
   *   The name of the context in the plugin definition.
   *
   * @return bool
   *   Whether the context definition exists.
   */
  public function hasContextDefinition($name);

}

Members

Namesort descending Modifiers Type Description Overrides
PluginContextDefinitionInterface::getContextDefinition public function Gets a specific context definition. 1
PluginContextDefinitionInterface::getContextDefinitions public function Gets the context definitions. 1
PluginContextDefinitionInterface::hasContextDefinition public function Checks if a specific context definition exists. 1
PluginContextDefinitionInterface::setContextDefinition public function Sets a specific context definition. 1
PluginContextDefinitionInterface::setContextDefinitions public function Sets the context definitions. 1
PluginDefinitionInterface::getClass public function Gets the class. 1
PluginDefinitionInterface::getId public function Gets the plugin ID. 2
PluginDefinitionInterface::getProvider public function Gets the plugin provider. Overrides PluginDefinitionInterface::getProvider 2
PluginDefinitionInterface::id public function Gets the unique identifier of the plugin. 1
PluginDefinitionInterface::mergeDefaultDefinition public function Merges another definition into this one, using the other for defaults.
PluginDefinitionInterface::mergeOverrideDefinition public function Merges another definition into this one, using the other for overrides.
PluginDefinitionInterface::setClass public function Sets the class. 1
PluginDefinitionInterface::setId public function Sets the plugin ID. 2
PluginDefinitionInterface::setProvider public function Sets the plugin provider. 2