public function ConfigReverter::delete in Configuration Update Manager 8
Deletes a configuration item.
This action triggers a ConfigDeleteInterface::DELETE event.
Parameters
string $type: The type of configuration.
string $name: The name of the config item, without the prefix.
Return value
bool TRUE if the operation succeeded; FALSE if the base configuration could not be found to delete. May also throw exceptions if there is a problem during deleting the configuration.
Overrides ConfigDeleteInterface::delete
See also
\Drupal\config_update\ConfigDeleteInterface::DELETE
File
- src/
ConfigReverter.php, line 176
Class
- ConfigReverter
- Provides methods related to config reverting, deleting, and importing.
Namespace
Drupal\config_updateCode
public function delete($type, $name) {
$config = FALSE;
$full_name = $this
->getFullName($type, $name);
if ($full_name) {
// Make sure the configuration exists currently in active storage.
if (!$this->activeConfigStorage
->read($full_name)) {
return FALSE;
}
$config = $this->configFactory
->getEditable($full_name);
}
if (!$config) {
return FALSE;
}
$config
->delete();
// Trigger an event notifying of this change.
$event = new ConfigRevertEvent($type, $name);
$this->dispatcher
->dispatch(ConfigDeleteInterface::DELETE, $event);
return TRUE;
}