You are here

invite_token.inc in Invite 5

Same filename and directory in other branches
  1. 5.2 invite_token.inc
  2. 6.2 invite_token.inc

File

invite_token.inc
View source
<?php

/**
 * For a given context, builds a formatted list of tokens and descriptions
 * of their replacement values.
 *
 * @param type
 *    The token types to display documentation for. Defaults to 'all'.
 * @param prefix
 *    The prefix your module will use when parsing tokens. Defaults to '['
 * @param suffix
 *    The suffix your module will use when parsing tokens. Defaults to ']'
 * @return An HTML table containing the formatting docs.
 **/
function theme_invite_token_help($type = 'all', $prefix = '[', $suffix = ']') {
  token_include();

  // see http://drupal.org/node/127072
  $full_list = array();
  foreach ((array) $type as $t) {
    $full_list = array_merge($full_list, token_get_list($t));
  }
  $headers = array(
    t('Token'),
    t('Replacement value'),
  );
  $rows = array();
  foreach ($full_list as $key => $category) {
    $rows[] = array(
      array(
        'data' => drupal_ucfirst($key) . ' ' . t('tokens'),
        '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;
}

Functions

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