class Plugin

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Component/Plugin/Attribute/Plugin.php \Drupal\Component\Plugin\Attribute\Plugin
  2. 11.x composer/Plugin/RecipeUnpack/Plugin.php \Drupal\Composer\Plugin\RecipeUnpack\Plugin

Defines a Plugin attribute object.

Attributes in plugin classes can use this class in order to pass various metadata about the plugin through the parser to DiscoveryInterface::getDefinitions() calls.

Hierarchy

Expanded class hierarchy of Plugin

53 files declare their use of Plugin
Action.php in core/lib/Drupal/Core/Action/Attribute/Action.php
Archiver.php in core/lib/Drupal/Core/Archiver/Attribute/Archiver.php
AttributeBridgeDecoratorTest.php in core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
AttributeClassDiscovery.php in core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php
AttributeDiscoveryTest1.php in core/tests/fixtures/plugins/Plugin/PluginNamespace/AttributeDiscoveryTest1.php

... See full list

4 string references to 'Plugin'
ActionValidationTest::testInvalidPluginId in core/modules/system/tests/src/Kernel/Entity/ActionValidationTest.php
Tests that the action plugin ID is validated.
BlockValidationTest::testInvalidPluginId in core/modules/block/tests/src/Kernel/BlockValidationTest.php
Tests validating a block with an unknown plugin ID.
MappingTest::providerMappingInterpretation in core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php
Provides test cases for all kinds of i) dynamic typing, ii) optional keys.
SearchPageValidationTest::testInvalidPluginId in core/modules/search/tests/src/Kernel/SearchPageValidationTest.php
Tests that the search plugin ID is validated.

File

core/lib/Drupal/Component/Plugin/Attribute/Plugin.php, line 14

Namespace

Drupal\Component\Plugin\Attribute
View source
class Plugin extends AttributeBase {
  
  /**
   * Constructs a plugin attribute object.
   *
   * @param string $id
   *   The attribute class ID.
   * @param class-string|null $deriver
   *   (optional) The deriver class.
   */
  public function __construct(public readonly string $id, public readonly ?string $deriver = NULL) {
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AttributeBase::$class protected property The class used for this attribute class.
AttributeBase::$provider protected property The provider of the attribute class.
AttributeBase::get public function Gets the value of an attribute. Overrides AttributeInterface::get 1
AttributeBase::getClass public function Gets the class of the attribute class. Overrides AttributeInterface::getClass
AttributeBase::getId public function Gets the unique ID for this attribute class. Overrides AttributeInterface::getId
AttributeBase::getProvider public function Gets the name of the provider of the attribute class. Overrides AttributeInterface::getProvider
AttributeBase::setClass public function Sets the class of the attributed class. Overrides AttributeInterface::setClass
AttributeBase::setProvider public function Sets the name of the provider of the attribute class. Overrides AttributeInterface::setProvider
Plugin::__construct public function Constructs a plugin attribute object. Overrides AttributeBase::__construct

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