You are here

function theme_token_help in Token 6

Same name and namespace in other branches
  1. 5 token.module \theme_token_help()

For a given context, builds a formatted list of tokens and descriptions of their replacement values.

Parameters

types: The token types to display documentation for. Can be either a single string or an array of token types. Defaults to 'all'.

prefix: The prefix your module will use when parsing tokens. Defaults to '['

suffix: The suffix your module will use when parsing tokens. Defaults to ']'

Return value

An HTML table containing the formatting docs.

1 theme call to theme_token_help()
token_rules_input_evaluator_help in ./token.rules.inc
Some token replacement help for the condition/action edit form.

File

./token.pages.inc, line 23
User page callbacks for the token module.

Code

function theme_token_help($types = 'all', $prefix = TOKEN_PREFIX, $suffix = TOKEN_SUFFIX) {
  token_include();
  $full_list = token_get_list($types);
  $headers = array(
    t('Token'),
    t('Replacement value'),
  );
  $rows = array();
  foreach ($full_list as $key => $category) {
    $rows[] = array(
      array(
        'data' => t('@type tokens', array(
          '@type' => drupal_ucfirst($key),
        )),
        'class' => 'region',
        'colspan' => 2,
      ),
    );
    foreach ($category as $token => $description) {
      $row = array();
      $row[] = $prefix . $token . $suffix;
      $row[] = $description;
      $rows[] = $row;
    }
  }
  $output = theme('table', $headers, $rows, array(
    'class' => 'description',
  ));
  return $output;
}