You are here

protected function ConfigUpdateUiCliService::getConfigShortname in Configuration Update Manager 8

Gets the config item shortname given the type and name.

Parameters

string $type: The type of the config item.

string $name: The name of the config item.

Return value

string The shortname for the configuration item.

2 calls to ConfigUpdateUiCliService::getConfigShortname()
ConfigUpdateUiCliService::importMissing in config_update_ui/src/ConfigUpdateUiCliService.php
Imports missing config item.
ConfigUpdateUiCliService::revert in config_update_ui/src/ConfigUpdateUiCliService.php
Reverts a config item.

File

config_update_ui/src/ConfigUpdateUiCliService.php, line 379

Class

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

Namespace

Drupal\config_update_ui

Code

protected function getConfigShortname($type, $name) {
  $shortname = $name;
  if ($type != 'system.simple') {
    $definition = $this->entityManager
      ->getDefinition($type);
    $prefix = $definition
      ->getConfigPrefix() . '.';
    if (strpos($name, $prefix) === 0) {
      $shortname = substr($name, strlen($prefix));
    }
  }
  return $shortname;
}