You are here

protected function DefaultPluginManager::findDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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.

1 call to DefaultPluginManager::findDefinitions()
DefaultPluginManager::getDefinitions in core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
Gets the definition of all plugins for this type.
2 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.

File

core/lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 267
Contains \Drupal\Core\Plugin\DefaultPluginManager.

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) {

    // If the plugin definition is an object, attempt to convert it to an
    // array, if that is not possible, skip further processing.
    if (is_object($plugin_definition) && !($plugin_definition = (array) $plugin_definition)) {
      continue;
    }
    if (isset($plugin_definition['provider']) && !in_array($plugin_definition['provider'], array(
      'core',
      'component',
    )) && !$this
      ->providerExists($plugin_definition['provider'])) {
      unset($definitions[$plugin_id]);
    }
  }
  return $definitions;
}