You are here

protected function DefaultPluginManager::findDefinitions in Plug 7

Finds plugin definitions.

Return value

array List of definitions to store in cache.

1 call to DefaultPluginManager::findDefinitions()
DefaultPluginManager::getDefinitions in lib/Drupal/Core/Plugin/DefaultPluginManager.php
Gets the definition of all plugins for this type.

File

lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 282
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;
}