function ExcludedModulesEventSubscriber::getDependentConfigNames

Same name in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php \Drupal\Core\EventSubscriber\ExcludedModulesEventSubscriber::getDependentConfigNames()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php \Drupal\Core\EventSubscriber\ExcludedModulesEventSubscriber::getDependentConfigNames()
  3. 10 core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php \Drupal\Core\EventSubscriber\ExcludedModulesEventSubscriber::getDependentConfigNames()

Get all the configuration which depends on one of the excluded modules.

Return value

string[] An array of configuration names.

2 calls to ExcludedModulesEventSubscriber::getDependentConfigNames()
ExcludedModulesEventSubscriber::onConfigTransformExport in core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php
Transform the storage which is used to export the configuration.
ExcludedModulesEventSubscriber::onConfigTransformImport in core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php
Transform the storage which is used to import the configuration.

File

core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php, line 157

Class

ExcludedModulesEventSubscriber
The event subscriber preventing excluded modules to be exported.

Namespace

Drupal\Core\EventSubscriber

Code

private function getDependentConfigNames() {
    $modules = $this->getExcludedModules();
    $dependencyManager = $this->manager
        ->getConfigDependencyManager();
    $config = [];
    // Find all the configuration depending on the excluded modules.
    foreach ($modules as $module) {
        foreach ($dependencyManager->getDependentEntities('module', $module) as $dependent) {
            $config[] = $dependent->getConfigDependencyName();
        }
        $config = array_merge($config, $this->activeStorage
            ->listAll($module . '.'));
    }
    // Find all configuration that depends on the configuration found above.
    foreach ($this->manager
        ->findConfigEntityDependencies('config', array_unique($config)) as $dependent) {
        $config[] = $dependent->getConfigDependencyName();
    }
    return array_unique($config);
}

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