function AttributeDiscoveryWithAnnotations::__construct

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php \Drupal\Core\Plugin\Discovery\AttributeDiscoveryWithAnnotations::__construct()

Constructs an AttributeDiscoveryWithAnnotations object.

Parameters

string $subdir: Either the plugin's subdirectory, for example 'Plugin/views/filter', or empty string if plugins are located at the top level of the namespace.

\Traversable $rootNamespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations. If $subdir is not an empty string, it will be appended to each namespace.

string $pluginDefinitionAttributeName: (optional) The name of the attribute that contains the plugin definition. Defaults to 'Drupal\Component\Plugin\Attribute\Plugin'.

string $pluginDefinitionAnnotationName: (optional) The name of the attribute that contains the plugin definition. Defaults to 'Drupal\Component\Annotation\Plugin'.

string[] $additionalNamespaces: (optional) Additional namespaces to scan for attribute definitions.

Overrides AttributeClassDiscovery::__construct

File

core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php, line 43

Class

AttributeDiscoveryWithAnnotations
Enables both attribute and annotation discovery for plugin definitions.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function __construct(string $subdir, \Traversable $rootNamespaces, string $pluginDefinitionAttributeName = 'Drupal\\Component\\Plugin\\Attribute\\Plugin', string $pluginDefinitionAnnotationName = 'Drupal\\Component\\Annotation\\Plugin', array $additionalNamespaces = []) {
    parent::__construct($subdir, $rootNamespaces, $pluginDefinitionAttributeName);
}

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