You are here

function AnnotatedClassDiscovery::__construct in Service Container 7

Same name in this branch
  1. 7 lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
  2. 7 modules/providers/service_container_annotation_discovery/src/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\service_container_annotation_discovery\Plugin\Discovery\AnnotatedClassDiscovery::__construct()
Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_annotation_discovery/src/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\service_container_annotation_discovery\Plugin\Discovery\AnnotatedClassDiscovery::__construct()

Constructs a new instance.

Parameters

string[] $plugin_manager_definition: (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'.

File

modules/providers/service_container_annotation_discovery/src/Plugin/Discovery/AnnotatedClassDiscovery.php, line 66
Contains \Drupal\service_container_annotation_discovery\Plugin\Discovery\AnnotatedClassDiscovery

Class

AnnotatedClassDiscovery
TODO

Namespace

Drupal\service_container_annotation_discovery\Plugin\Discovery

Code

function __construct($plugin_manager_definition, $plugin_definition_annotation_name = 'Drupal\\Component\\Annotation\\Plugin') {
  $namespaces = array();
  foreach (module_list() as $module_name) {
    $directory = DRUPAL_ROOT . '/' . drupal_get_path('module', $module_name) . '/src/' . trim($plugin_manager_definition['directory'], DIRECTORY_SEPARATOR);
    $namespaces['Drupal\\' . $module_name] = array(
      $directory,
    );
  }
  $this->pluginNamespaces = new \ArrayObject($namespaces);
  $this->pluginDefinitionAnnotationName = isset($plugin_manager_definition['class']) ? $plugin_manager_definition['class'] : $plugin_definition_annotation_name;
  $this->pluginManagerDefinition = $plugin_manager_definition;
}