You are here

protected function FarmUpdate::getConfigShortname in farmOS 2.x

Gets the config item shortname given the type and name.

This method is copied directly from ConfigUpdateUiCliService.

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.

See also

\Drupal\config_update_ui\ConfigUpdateUiCliService::getConfigShortname()

1 call to FarmUpdate::getConfigShortname()
FarmUpdate::rebuild in modules/core/update/src/FarmUpdate.php
Rebuild farmOS configuration.

File

modules/core/update/src/FarmUpdate.php, line 207

Class

FarmUpdate
Farm update service.

Namespace

Drupal\farm_update

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;
}