You are here

public function ConfigUpdateUiCliService::importMissing in Configuration Update Manager 8

Imports missing config item.

Imports a missing or inactive config item provided by an installed module, theme, or install profile. Be sure that requirements are met.

Parameters

string $name: The name of the config item to import (usually the ID you would see in the user interface). See config-missing-report to list config items that are missing, and config-inactive-report to list config items that are inactive.

File

config_update_ui/src/ConfigUpdateUiCliService.php, line 272

Class

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

Namespace

Drupal\config_update_ui

Code

public function importMissing($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
    ->import($type, $shortname)) {
    $this->logger
      ->success(dt('The configuration item @name was imported from its source.', [
      '@name' => $name,
    ]));
  }
  else {
    $this->logger
      ->error(dt('There was an error and the configuration item @name was not imported.', [
      '@name' => $name,
    ]));
  }
}