You are here

protected function DefaultPluginManager::findDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::findDefinitions()
  2. 10 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::findDefinitions()

Finds plugin definitions.

Return value

array List of definitions to store in cache.

4 calls to DefaultPluginManager::findDefinitions()
DefaultPluginManager::getDefinitions in core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
Gets the definition of all plugins for this type.
HelpTopicPluginManager::findDefinitions in core/modules/help_topics/src/HelpTopicPluginManager.php
Finds plugin definitions.
MigrateFieldPluginManager::findDefinitions in core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
Finds plugin definitions.
SectionStorageManager::findDefinitions in core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php
Finds plugin definitions.
7 methods override DefaultPluginManager::findDefinitions()
ConfigMapperManager::findDefinitions in core/modules/config_translation/src/ConfigMapperManager.php
Finds plugin definitions.
EntityTypeManager::findDefinitions in core/lib/Drupal/Core/Entity/EntityTypeManager.php
Finds plugin definitions.
HelpTopicPluginManager::findDefinitions in core/modules/help_topics/src/HelpTopicPluginManager.php
Finds plugin definitions.
MigrateFieldPluginManager::findDefinitions in core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
Finds plugin definitions.
MigrateSourcePluginManager::findDefinitions in core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php
Finds plugin definitions.

... See full list

File

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

Class

DefaultPluginManager
Base class for plugin managers.

Namespace

Drupal\Core\Plugin

Code

protected function findDefinitions() {
  $definitions = $this
    ->getDiscovery()
    ->getDefinitions();
  foreach ($definitions as $plugin_id => &$definition) {
    $this
      ->processDefinition($definition, $plugin_id);
  }
  $this
    ->alterDefinitions($definitions);

  // If this plugin was provided by a module that does not exist, remove the
  // plugin definition.
  foreach ($definitions as $plugin_id => $plugin_definition) {
    $provider = $this
      ->extractProviderFromDefinition($plugin_definition);
    if ($provider && !in_array($provider, [
      'core',
      'component',
    ]) && !$this
      ->providerExists($provider)) {
      unset($definitions[$plugin_id]);
    }
  }
  return $definitions;
}