function AnnotatedClassDiscovery::__construct

Same name in this branch
  1. 10 core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  2. 9 core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  3. 8.9.x core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  4. 8.9.x core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  5. 11.x core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  6. 11.x core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::__construct()

Constructs a new instance.

Parameters

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

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

string[] $annotation_namespaces: (optional) Additional namespaces to be scanned for annotation classes.

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

File

core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php, line 72

Class

AnnotatedClassDiscovery
Defines a discovery mechanism to find annotated plugins in PSR-4 namespaces.

Namespace

Drupal\Component\Annotation\Plugin\Discovery

Code

public function __construct($plugin_namespaces = [], $plugin_definition_annotation_name = 'Drupal\\Component\\Annotation\\Plugin', array $annotation_namespaces = []) {
    $this->pluginNamespaces = $plugin_namespaces;
    $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name;
    $this->annotationNamespaces = $annotation_namespaces;
    $file_cache_suffix = str_replace('\\', '_', $plugin_definition_annotation_name);
    $file_cache_suffix .= ':' . Crypt::hashBase64(serialize($annotation_namespaces));
    $this->fileCache = FileCacheFactory::get('annotation_discovery:' . $file_cache_suffix);
}

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