interface ContextAwarePluginDefinitionInterface

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface
  2. 10 core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface
  3. 11.x core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface

Provides an interface for plugin definitions which use contexts.

Hierarchy

Expanded class hierarchy of ContextAwarePluginDefinitionInterface

All classes that implement ContextAwarePluginDefinitionInterface

8 files declare their use of ContextAwarePluginDefinitionInterface
ContextAwarePluginBase.php in core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
ContextAwarePluginBaseTest.php in core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
ContextAwarePluginTrait.php in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
ContextAwarePluginTraitTest.php in core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
ContextHandler.php in core/lib/Drupal/Core/Plugin/Context/ContextHandler.php

... See full list

File

core/lib/Drupal/Component/Plugin/Definition/ContextAwarePluginDefinitionInterface.php, line 12

Namespace

Drupal\Component\Plugin\Definition
View source
interface ContextAwarePluginDefinitionInterface extends PluginDefinitionInterface {
    
    /**
     * Checks if the plugin defines a particular context.
     *
     * @param string $name
     *   The context name.
     *
     * @return bool
     *   TRUE if the plugin defines the given context, otherwise FALSE.
     */
    public function hasContextDefinition($name);
    
    /**
     * Returns all context definitions for this plugin.
     *
     * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface[]
     *   The context definitions.
     */
    public function getContextDefinitions();
    
    /**
     * Returns a particular context definition for this plugin.
     *
     * @param string $name
     *   The context name.
     *
     * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
     *   The context definition.
     *
     * @throws \Drupal\Component\Plugin\Exception\ContextException
     *   Thrown if the plugin does not define the given context.
     */
    public function getContextDefinition($name);
    
    /**
     * Adds a context to this plugin definition.
     *
     * @param string $name
     *   The context name.
     * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $definition
     *   The context definition.
     *
     * @return $this
     *   The called object.
     */
    public function addContextDefinition($name, ContextDefinitionInterface $definition);
    
    /**
     * Removes a context definition from this plugin.
     *
     * @param string $name
     *   The context name.
     *
     * @return $this
     *   The called object.
     */
    public function removeContextDefinition($name);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ContextAwarePluginDefinitionInterface::addContextDefinition public function Adds a context to this plugin definition.
ContextAwarePluginDefinitionInterface::getContextDefinition public function Returns a particular context definition for this plugin.
ContextAwarePluginDefinitionInterface::getContextDefinitions public function Returns all context definitions for this plugin.
ContextAwarePluginDefinitionInterface::hasContextDefinition public function Checks if the plugin defines a particular context.
ContextAwarePluginDefinitionInterface::removeContextDefinition public function Removes a context definition from this plugin.
PluginDefinitionInterface::getClass public function Gets the class. 1
PluginDefinitionInterface::getProvider public function Gets the plugin provider. 1
PluginDefinitionInterface::id public function Gets the unique identifier of the plugin. 1
PluginDefinitionInterface::setClass public function Sets the class. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.