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.
string $name: Configuration name with variables in square brackets.
mixed $data: Configuration data for the element.
string Configuration name with variables replaced.
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;
}
}