protected function AnnotatedClassDiscovery::getPluginNamespaces in Plug 7
Same name in this branch
- 7 lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getPluginNamespaces()
- 7 lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::getPluginNamespaces()
Gets an array of PSR-0 namespaces to search for plugin classes.
Return value
string[]
Overrides AnnotatedClassDiscovery::getPluginNamespaces
File
- lib/
Drupal/ Core/ Plugin/ Discovery/ AnnotatedClassDiscovery.php, line 118 - Contains \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery.
Class
- AnnotatedClassDiscovery
- Defines a discovery mechanism to find annotated plugins in PSR-0 namespaces.
Namespace
Drupal\Core\Plugin\DiscoveryCode
protected function getPluginNamespaces() {
$plugin_namespaces = array();
if ($this->namespaceSuffix) {
foreach ($this->rootNamespacesIterator as $namespace => $dirs) {
// Append the namespace suffix to the base namespace, to obtain the
// plugin namespace. E.g. 'Drupal\Views' may become
// 'Drupal\Views\Plugin\Block'.
$namespace .= $this->namespaceSuffix;
foreach ((array) $dirs as $dir) {
// Append the directory suffix to the PSR-4 base directory, to obtain
// the directory where plugins are found.
// E.g. DRUPAL_ROOT . '/core/modules/views/src' may become
// DRUPAL_ROOT . '/core/modules/views/src/Plugin/Block'.
$plugin_namespaces[$namespace][] = $dir . $this->directorySuffix;
}
}
}
else {
// Both the namespace suffix and the directory suffix are empty,
// so the plugin namespaces and directories are the same as the base
// directories.
foreach ($this->rootNamespacesIterator as $namespace => $dirs) {
$plugin_namespaces[$namespace] = (array) $dirs;
}
}
return $plugin_namespaces;
}