You are here

protected function ConfigMapperManager::findDefinitions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/config_translation/src/ConfigMapperManager.php \Drupal\config_translation\ConfigMapperManager::findDefinitions()

Finds plugin definitions.

Return value

array List of definitions to store in cache.

Overrides DefaultPluginManager::findDefinitions

File

core/modules/config_translation/src/ConfigMapperManager.php, line 146

Class

ConfigMapperManager
Manages plugins for configuration translation mappers.

Namespace

Drupal\config_translation

Code

protected function findDefinitions() {
  $definitions = $this
    ->getDiscovery()
    ->getDefinitions();
  foreach ($definitions as $plugin_id => &$definition) {
    $this
      ->processDefinition($definition, $plugin_id);
  }
  if ($this->alterHook) {
    $this->moduleHandler
      ->alter($this->alterHook, $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 (isset($plugin_definition['provider']) && !in_array($plugin_definition['provider'], [
      'core',
      'component',
    ]) && (!$this->moduleHandler
      ->moduleExists($plugin_definition['provider']) && !in_array($plugin_definition['provider'], array_keys($this->themeHandler
      ->listInfo())))) {
      unset($definitions[$plugin_id]);
    }
  }
  return $definitions;
}