function token_var_tokens in Token Variable 8
Same name and namespace in other branches
- 7 token_var.module \token_var_tokens()
Implements hook_tokens().
File
- ./
token_var.module, line 42 - Contains module code.
Code
function token_var_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacement = array();
if ($type == 'variables') {
foreach ($tokens as $name => $original) {
$name = explode(':', $name);
$key = $name[1];
$name = str_replace('|', '.', $name[0]);
$replacement[$original] = \Drupal::config($name)
->get($key);
}
}
return $replacement;
}