Index: tokenSTARTER.module =================================================================== RCS file: /cvs/drupal/contributions/modules/token/Attic/tokenSTARTER.module,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 tokenSTARTER.module --- tokenSTARTER.module 14 May 2009 16:06:47 -0000 1.1.2.2 +++ tokenSTARTER.module 15 Aug 2009 18:11:07 -0000 @@ -6,9 +6,10 @@ * @file * The Token API module. * - * The Token module provides an API for providing tokens to other modules. - * Tokens are small bits of text that can be placed into larger documents - * via simple placeholders, like %site-name or [user]. + * Provides a sample version of what can be done with token module. You + * shouldn't edit this module directly but rename it and then edit it + * (so your changes won't be overwritten by future versions of the token + * module). See the README.txt for more information. * * @ingroup token */ @@ -17,6 +18,7 @@ * Implementation of hook_token_list(). */ function tokenSTARTER_token_list($type = 'all') { + $tokens = array(); if ($type == 'global' || $type == 'all') { $tokens['global']['random-sha1'] = t("A randomly generated SHA1 hash."); $tokens['global']['site-date-timestamp'] = t('The current timestamp in seconds past January 1, 1970.'); @@ -26,6 +28,7 @@ $tokens['global']['random-alpha-1'] = t('Randomly generated single-digit letter.'); $tokens['global']['random-alpha-3'] = t('Randomly generated three-digit letters.'); $tokens['global']['random-alpha-10'] = t('Randomly generated ten-digit letters.'); + $tokens['global']['query-name'] = t('The value of the field name from the url query string.'); } if ($type == 'node' || $type == 'all') { // Node tokens here. @@ -57,7 +60,16 @@ $time = time(); $tz = variable_get('date_default_timezone', 0); $values['site-date-timestamp'] = format_date($time, 'custom', 'Y', $tz); - + // Create query tokens. + $url = parse_url($_SERVER['REQUEST_URI']); + $query = $url['query']; + if (isset($query) && $query != '') { + $output = array(); + parse_str($query, $output); + foreach ($output as $field => $value) { + $values['query-' . $field] = $value; + } + } break; case 'node': // Node tokens here.