TypedConfigManager::replaceName

protected TypedConfigManager::replaceName($name, $data)

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.

File

core/lib/Drupal/Core/Config/TypedConfigManager.php, line 265

Class

TypedConfigManager
Manages config schema type plugins.

Namespace

Drupal\Core\Config

Code

protected function replaceName($name, $data) {
  if (preg_match_all("/\[(.*)\]/U", $name, $matches)) {
    // Build our list of '[value]' => replacement.
    $replace = array();
    foreach (array_combine($matches[0], $matches[1]) as $key => $value) {
      $replace[$key] = $this->replaceVariable($value, $data);
    }
    return strtr($name, $replace);
  }
  else {
    return $name;
  }
}
doc_Drupal
2016-10-29 09:49:55
Comments
Leave a Comment

Please login to continue.