protected static function TypedConfigManager::replaceName

Replaces variables in configuration name.

The configuration name may contain one or more variables to be replaced, enclosed in square brackets like '[name]' and will follow the replacement rules defined by the replaceVariable() method.

Parameters

string $name: Configuration name with variables in square brackets.

mixed $data: Configuration data for the element.

Return value

string Configuration name with variables replaced.

1 call to TypedConfigManager::replaceName()

File

drupal/core/lib/Drupal/Core/Config/TypedConfigManager.php, line 98
Contains \Drupal\Core\Config\TypedConfigManager.

Class

TypedConfigManager
Manages config type plugins.

Namespace

Drupal\Core\Config

Code

protected static function replaceName($name, $data) {
  if (preg_match_all("/\\[(.*)\\]/U", $name, $matches)) {

    // Build our list of '[value]' => replacement.
    foreach (array_combine($matches[0], $matches[1]) as $key => $value) {
      $replace[$key] = self::replaceVariable($value, $data);
    }
    return strtr($name, $replace);
  }
  else {
    return $name;
  }
}