You are here

public function ConfigSelector::setUninstallConfigList in Configuration selector 8.2

Same name and namespace in other branches
  1. 8 src/ConfigSelector.php \Drupal\config_selector\ConfigSelector::setUninstallConfigList()

Determines if a Configuration Selector feature might during an uninstall.

Stores a list of affected features keyed by full configuration object name.

Parameters

string $module: The module being uninstalled.

Return value

$this

See also

config_selector_module_preuninstall()

File

src/ConfigSelector.php, line 163

Class

ConfigSelector
Selects configuration to enable after a module install or uninstall.

Namespace

Drupal\config_selector

Code

public function setUninstallConfigList($module) {

  // Get a list of config entities that might be deleted.
  $config_entities = $this->configManager
    ->findConfigEntityDependentsAsEntities('module', [
    $module,
  ]);

  // We need to keep adding to the list since more than one module might be
  // uninstalled at a time.
  $features = $this->state
    ->get('config_selector.feature_uninstall_list', []);
  foreach ($config_entities as $config_entity) {
    if (!$config_entity
      ->status()) {

      // We are only interested in enabled configuration entities, ie.
      // functionality a user might lose.
      continue;
    }
    $feature = $config_entity
      ->getThirdPartySetting('config_selector', 'feature');
    if ($feature !== NULL) {
      $features[$config_entity
        ->getConfigDependencyName()] = $feature;
    }
  }
  $this->state
    ->set('config_selector.feature_uninstall_list', $features);
  return $this;
}