function config_pages_tokens in Config Pages 8.2
Implements hook_tokens().
File
- ./
config_pages.tokens.inc, line 52 - Builds placeholder replacement tokens for configration pages.
Code
function config_pages_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacements = [];
if ($type != 'config_page') {
return $replacements;
}
foreach ($tokens as $name => $original) {
$parts = explode(':', $name);
// First argument is always the type of config_pages.
$config_page_name = array_shift($parts);
$config_page = config_pages_config($config_page_name);
if ($entity_tokens = \Drupal::token()
->findWithPrefix($tokens, $config_page_name)) {
$replacements += \Drupal::token()
->generate('config_pages', $entity_tokens, [
'config_pages' => $config_page,
], $options, $bubbleable_metadata);
}
}
return $replacements;
}