You are here

public function ConfigUpdateUiCliService::revert in Configuration Update Manager 8

Reverts a config item.

Reverts one config item in active storage to the version provided by an installed module, theme, or install profile.

Parameters

string $name: The config item to revert. See config-different-report to list config items that are different.

1 call to ConfigUpdateUiCliService::revert()
ConfigUpdateUiCliService::revertMultiple in config_update_ui/src/ConfigUpdateUiCliService.php
Reverts multiple config items to extension provided version.

File

config_update_ui/src/ConfigUpdateUiCliService.php, line 244

Class

ConfigUpdateUiCliService
Handles all the logic for commands for various versions of Drush.

Namespace

Drupal\config_update_ui

Code

public function revert($name) {
  $type = $this->configList
    ->getTypeNameByConfigName($name);

  // The lister gives NULL if simple configuration, but the reverter expects
  // 'system.simple' so we convert it.
  if ($type === NULL) {
    $type = 'system.simple';
  }
  $shortname = $this
    ->getConfigShortname($type, $name);
  if ($this->configUpdate
    ->revert($type, $shortname)) {
    $this->logger
      ->success(dt('The configuration item @name was reverted to its source.', [
      '@name' => $name,
    ]));
  }
  else {
    $this->logger
      ->error(dt('There was an error and the configuration item @name was not reverted.', [
      '@name' => $name,
    ]));
  }
}