You are here

protected function FeaturesManager::getConfigDependency in Open Social 8.8

File

modules/social_features/social_core/src/FeaturesRemoval/FeaturesManager.php, line 34

Class

FeaturesManager
Overrides the features FeaturesManager.

Namespace

Drupal\social_core\FeaturesRemoval

Code

protected function getConfigDependency(ConfigurationItem $config, $module_list = []) {
  $dependencies = [];
  $type = $config
    ->getType();

  // For configuration in the InstallStorage::CONFIG_INSTALL_DIRECTORY
  // directory, set any dependencies of the configuration item as package
  // dependencies.
  // As its name implies, the core-provided
  // InstallStorage::CONFIG_OPTIONAL_DIRECTORY should not create
  // dependencies.
  // @phpcs:
  //    if ($config->getSubdirectory() === InstallStorage::CONFIG_INSTALL_DIRECTORY) {
  if ($config
    ->getSubdirectory() === 'config/features_removal') {
    if ($type === FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG) {
      $dependencies[] = strtok($config
        ->getName(), '.');
    }
    else {
      $dependencies[] = $this->entityTypeManager
        ->getDefinition($type)
        ->getProvider();
    }
    if (isset($config
      ->getData()['dependencies']['module'])) {
      $dependencies = array_merge($dependencies, $config
        ->getData()['dependencies']['module']);
    }

    // Only return dependencies for installed modules and not, for example,
    // 'core'.
    $dependencies = array_intersect($dependencies, array_keys($module_list));
  }
  return $dependencies;
}