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
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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 ; } } |
Please login to continue.