Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContextAwarePluginDefinitionInterface.php

interface ContextAwarePluginDefinitionInterface

Provides an interface for plugin definitions which use contexts.

Hierarchy

  • interface \Drupal\Component\Plugin\Definition\PluginDefinitionInterface
    • interface \Drupal\Component\Plugin\Definition\ContextAwarePluginDefinitionInterface extends \Drupal\Component\Plugin\Definition\PluginDefinitionInterface

Expanded class hierarchy of ContextAwarePluginDefinitionInterface

All classes that implement ContextAwarePluginDefinitionInterface

4 files declare their use of ContextAwarePluginDefinitionInterface
ContextAwarePluginTrait.php in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
ContextHandler.php in core/lib/Drupal/Core/Plugin/Context/ContextHandler.php
LayoutDefinition.php in core/lib/Drupal/Core/Layout/LayoutDefinition.php
SectionStorageDefinition.php in core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal