function AnnotatedClassDiscovery::getPluginNamespaces

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

Overrides AnnotatedClassDiscovery::getPluginNamespaces

1 call to AnnotatedClassDiscovery::getPluginNamespaces()
AnnotatedClassDiscoveryAutomatedProviders::getDefinitions in core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php

File

core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php, line 118

Class

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

Namespace

Drupal\Core\Plugin\Discovery

Code

protected function getPluginNamespaces() {
    $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.