function AnnotatedClassDiscovery::__construct

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  2. 8.x drupal/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Plugin\Discovery\AnnotatedClassDiscovery::__construct()

Constructs an AnnotatedClassDiscovery object.

Parameters

string $subdir: The plugin's subdirectory, for example views/filter.

\Traversable $root_namespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations, \Plugin\$subdir will be appended to each namespace.

array $annotation_namespaces: (optional) The namespaces of classes that can be used as annotations. 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'.

Overrides AnnotatedClassDiscovery::__construct

File

drupal/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php, line 54
Definition of Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery.

Class

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

Namespace

Drupal\Core\Plugin\Discovery

Code

function __construct($subdir, \Traversable $root_namespaces, $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\\Component\\Annotation\\Plugin') {
  $this->subdir = str_replace('/', '\\', $subdir);
  $this->rootNamespacesIterator = $root_namespaces;
  $annotation_namespaces += array(
    'Drupal\\Component\\Annotation' => DRUPAL_ROOT . '/core/lib',
    'Drupal\\Core\\Annotation' => DRUPAL_ROOT . '/core/lib',
  );
  $plugin_namespaces = array();
  parent::__construct($plugin_namespaces, $annotation_namespaces, $plugin_definition_annotation_name);
}