function AttributeClassDiscovery::getPluginNamespaces
Same name in this branch
- 11.x core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::getPluginNamespaces()
Same name in other branches
- 10 core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::getPluginNamespaces()
- 10 core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::getPluginNamespaces()
Overrides AttributeClassDiscovery::getPluginNamespaces
File
-
core/
lib/ Drupal/ Core/ Plugin/ Discovery/ AttributeClassDiscovery.php, line 95
Class
- AttributeClassDiscovery
- Defines a discovery mechanism to find plugins using attributes.
Namespace
Drupal\Core\Plugin\DiscoveryCode
protected function getPluginNamespaces() : array {
$plugin_namespaces = [];
if ($this->namespaceSuffix) {
foreach ($this->rootNamespacesIterator as $namespace => $dirs) {
// Append the namespace suffix to the base namespace, to obtain the
// plugin namespace; for example, '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. For example,
// 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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.