function DefaultPluginManager::getDiscovery

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::getDiscovery()
  2. 8.9.x core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::getDiscovery()
  3. 10 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::getDiscovery()

Overrides PluginManagerBase::getDiscovery

16 methods override DefaultPluginManager::getDiscovery()
BreakpointManager::getDiscovery in core/modules/breakpoint/src/BreakpointManager.php
Gets the plugin discovery.
CKEditor5PluginManager::getDiscovery in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
Gets the plugin discovery.
ComponentPluginManager::getDiscovery in core/lib/Drupal/Core/Theme/ComponentPluginManager.php
Gets the plugin discovery.
ComponentPluginManager::getDiscovery in core/modules/sdc/src/ComponentPluginManager.php
Gets the plugin discovery.
ConfigMapperManager::getDiscovery in core/modules/config_translation/src/ConfigMapperManager.php
Gets the plugin discovery.

... See full list

File

core/lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 304

Class

DefaultPluginManager
Base class for plugin managers.

Namespace

Drupal\Core\Plugin

Code

protected function getDiscovery() {
    if (!$this->discovery) {
        if (isset($this->pluginDefinitionAttributeName) && isset($this->pluginDefinitionAnnotationName)) {
            $discovery = new AttributeDiscoveryWithAnnotations($this->subdir, $this->namespaces, $this->pluginDefinitionAttributeName, $this->pluginDefinitionAnnotationName, $this->additionalAnnotationNamespaces);
        }
        elseif (isset($this->pluginDefinitionAttributeName)) {
            $discovery = new AttributeClassDiscovery($this->subdir, $this->namespaces, $this->pluginDefinitionAttributeName);
        }
        else {
            $discovery = new AnnotatedClassDiscovery($this->subdir, $this->namespaces, $this->pluginDefinitionAnnotationName, $this->additionalAnnotationNamespaces);
        }
        $this->discovery = new ContainerDerivativeDiscoveryDecorator($discovery);
    }
    return $this->discovery;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.