On this page
public function ConfigManager::uninstall
public ConfigManager::uninstall($type, $name)
Uninstalls the configuration of a given extension.
Parameters
string $type: The extension type; e.g., 'module' or 'theme'.
string $name: The name of the module or theme to install configuration for.
Overrides ConfigManagerInterface::uninstall
File
- core/lib/Drupal/Core/Config/ConfigManager.php, line 193
Class
- ConfigManager
- The ConfigManager provides helper functions for the configuration system.
Namespace
Drupal\Core\ConfigCode
public function uninstall($type, $name) {
$entities = $this->getConfigEntitiesToChangeOnDependencyRemoval($type, [$name], FALSE);
// Fix all dependent configuration entities.
/** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
foreach ($entities['update'] as $entity) {
$entity->save();
}
// Remove all dependent configuration entities.
foreach ($entities['delete'] as $entity) {
$entity->setUninstalling(TRUE);
$entity->delete();
}
$config_names = $this->configFactory->listAll($name . '.');
foreach ($config_names as $config_name) {
$this->configFactory->getEditable($config_name)->delete();
}
// Remove any matching configuration from collections.
foreach ($this->activeStorage->getAllCollectionNames() as $collection) {
$collection_storage = $this->activeStorage->createCollection($collection);
$collection_storage->deleteAll($name . '.');
}
$schema_dir = drupal_get_path($type, $name) . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY;
if (is_dir($schema_dir)) {
// Refresh the schema cache if uninstalling an extension that provides
// configuration schema.
$this->typedConfigManager->clearCachedDefinitions();
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!ConfigManager.php/function/ConfigManager::uninstall/8.1.x