Example #1
0
 protected function getStorageDependentConfigs(StorageInterface $storage)
 {
     static $dependents = [];
     $storage_id = spl_object_hash($storage);
     if (!isset($dependents[$storage_id])) {
         // We cannot use the service config.manager because it depends on the
         // active storage.
         $manager = new ConfigManager(\Drupal::service('entity.manager'), new ConfigFactory($storage, \Drupal::service('event_dispatcher'), new TypedConfigManager($storage, new ExtensionInstallStorage($storage, 'config/schema'), \Drupal::service('cache.discovery'), \Drupal::service('module_handler'))), \Drupal::service('config.typed'), \Drupal::service('string_translation'), $storage, \Drupal::service('event_dispatcher'));
         // Get configs from other modules which depend on the given modules.
         $external_dependents = array_keys($manager->findConfigEntityDependents('module', $this->adjustments));
         // Get configs from the given modules (which obviously depend on them but
         // are not listed by findConfigEntityDependents().
         $adjustments = $this->adjustments;
         $internal_dependents = array_filter($storage->listAll(), function ($config_name) use($adjustments) {
             foreach ($this->adjustments as $module_name) {
                 if (strpos($config_name, $module_name . '.') === 0) {
                     return TRUE;
                 }
             }
             return FALSE;
         });
         $dependents[$storage_id] = array_unique(array_merge($internal_dependents, $external_dependents));
     }
     return $dependents[$storage_id];
 }