[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/token/tests/ -> token_test.module (source)

   1  <?php
   2  
   3  /**
   4   * Implements hook_exit().
   5   */
   6  function token_test_exit() {
   7    if ($debug = variable_get('token_page_tokens', array())) {
   8      $debug += array('tokens' => array(), 'data' => array(), 'options' => array());
   9      foreach (array_keys($debug['tokens']) as $token) {
  10        $debug['values'][$token] = token_replace_multiple($token, $debug['data'], TOKEN_PREFIX, TOKEN_SUFFIX, $debug['options']);
  11      }
  12      variable_set('token_page_tokens', $debug);
  13    }
  14  }
  15  
  16  /**
  17   * Implements hook_token_list().
  18   */
  19  function token_test_token_list($type = 'all') {
  20    $tokens = array();
  21  
  22    if ($type == 'all' || $type == 'global') {
  23      // Provide some wildcard tokens
  24      $tokens['token_test']['alpha']           = t("Token test Alpha.");
  25      $tokens['token_test']['beta-N']          = t("Token test Beta with wildcard.");
  26      $tokens['token_test']['gamma_?']       = t("Token test Gamme with wildcard.");
  27      $tokens['token_test']['delta-?']         = t("Token test Delta with wildcard.");
  28      $tokens['token_test']['epsilon-zeta-????']  = t("Token test Epsilon-Zeta with wildcard.");
  29    }
  30  
  31    return $tokens;
  32  }
  33  
  34  /**
  35   * Implements hook_token_values().
  36   */
  37  function token_test_token_values($type, $object = NULL, $options = array()) {
  38    $tokens = array();
  39  
  40    if ($type == 'global') {
  41      // Provide some wildcard token values
  42      $tokens['alpha']           = 'Alpha';
  43      $tokens['beta-1']          = 'Beta plus 1';
  44      $tokens['beta-2']          = 'Beta plus 2';
  45      $tokens['gamma_A']         = 'Gamma plus A';
  46      $tokens['delta-extra']     = 'Delta plus extra';
  47      $tokens['epsilon-zeta-A']  = 'Epsilon-Zeta plus A';
  48    }
  49  
  50    return $tokens;
  51  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7