function AttributeClassDiscovery::__construct

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::__construct()
Same name in other branches
  1. 10 core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::__construct()
  2. 10 core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::__construct()

Constructs a new instance.

Parameters

string[] $pluginNamespaces: (optional) An array of namespace that may contain plugin implementations. Defaults to an empty array.

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

1 method overrides AttributeClassDiscovery::__construct()
AttributeClassDiscovery::__construct in core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php
Constructs an AttributeClassDiscovery object.

File

core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php, line 32

Class

AttributeClassDiscovery
Defines a discovery mechanism to find plugins with attributes.

Namespace

Drupal\Component\Plugin\Discovery

Code

public function __construct(array $pluginNamespaces = [], string $pluginDefinitionAttributeName = Plugin::class) {
    $file_cache_suffix = str_replace('\\', '_', $this->pluginDefinitionAttributeName);
    $this->fileCache = FileCacheFactory::get('attribute_discovery:' . $this->getFileCacheSuffix($file_cache_suffix));
}

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