You are here

function token_module_test_page_attachments in Token 8

Implements hook_page_attachments().

File

tests/modules/token_module_test/token_module_test.module, line 13
Helper module for token tests.

Code

function token_module_test_page_attachments() {
  if ($debug = \Drupal::state()
    ->get('token_page_tokens', [])) {
    $debug += [
      'tokens' => [],
      'data' => [],
      'options' => [],
    ];
    foreach (array_keys($debug['tokens']) as $token) {
      $debug['values'][$token] = \Drupal::token()
        ->replace($token, $debug['data'], $debug['options']);
    }
    \Drupal::state()
      ->set('token_page_tokens', $debug);
  }
}