protected function TypedConfigManager::replaceName in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\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()
- TypedConfigManager::buildDataDefinition in core/
lib/ Drupal/ Core/ Config/ TypedConfigManager.php - Creates a new data definition object from a type definition array and actual configuration data. Since type definitions may contain variables to be replaced, we need the configuration value to create it.
File
- core/
lib/ Drupal/ Core/ Config/ TypedConfigManager.php, line 225 - Contains \Drupal\Core\Config\TypedConfigManager.
Class
- TypedConfigManager
- Manages config schema type plugins.
Namespace
Drupal\Core\ConfigCode
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;
}
}