token_test.module 795 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @file
  4. * Helper module for token tests.
  5. */
  6. /**
  7. * Implements hook_exit().
  8. */
  9. function token_test_exit() {
  10. if ($debug = variable_get('token_page_tokens', array())) {
  11. $debug += array('tokens' => array(), 'data' => array(), 'options' => array());
  12. foreach (array_keys($debug['tokens']) as $token) {
  13. $debug['values'][$token] = token_replace($token, $debug['data'], $debug['options']);
  14. }
  15. variable_set('token_page_tokens', $debug);
  16. }
  17. }
  18. /**
  19. * Implements hook_date_format_types().
  20. *
  21. * @todo Remove when http://drupal.org/node/1173706 is fixed.
  22. */
  23. function token_test_date_format_types() {
  24. $info['token_test'] = t('Token test date format');
  25. // Explicitly set the variable here as well.
  26. variable_set('date_format_token_test', 'Y');
  27. return $info;
  28. }