You are here

function theme_flag_token_help in Flag 5

Same name and namespace in other branches
  1. 6 includes/flag.token.inc \theme_flag_token_help()

This is a replacement for Token's theme_token_help().

This is a duplicate of the Token's function, but with a small modification: the $type parameter is now $types, allowing for listing tokens from several categories.

@todo Incorporate this feature into the Token module(?)

2 theme calls to theme_flag_token_help()
flag_actions_token_actions_send_email_action_form in ./flag_actions.module
flag_form in includes/flag.admin.inc
Add/Edit flag page.

File

includes/flag.token.inc, line 71
Flag module tokens support.

Code

function theme_flag_token_help($types = array(
  'all',
), $prefix = '[', $suffix = ']') {
  token_include();
  $tokens = flag_token_get_list($types);
  $headers = array(
    t('Token'),
    t('Replacement value'),
  );
  $rows = array();
  foreach ($tokens 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;
}