You are here

function theme_page_title_token_help in Page Title 7

An internal theme function to render the tokens to help the user. NOTE: Why is this not a core theme function?!

1 theme call to theme_page_title_token_help()
page_title_admin_settings in ./page_title.admin.inc
Displays the form for the standard settings tab.

File

./page_title.admin.inc, line 163
Admin include file.

Code

function theme_page_title_token_help() {
  $token_info = token_info();
  $output = '<p>' . t('Available tokens are:') . '</p>';
  $output .= '<dl>';

  // TODO: Sort out user:user token help... we cant do nested tokens this way. Recursive token_help theme function needed?
  foreach (array(
    'node',
    'term',
    'vocabulary',
    'site',
    'date',
  ) as $key) {
    $output .= "<dt><strong>{$token_info['types'][$key]['name']}</strong> - {$token_info['types'][$key]['description']}</dt>";
    $token_pairs = array();
    foreach ($token_info['tokens'][$key] as $token => $info) {
      $token_pairs[] = "<code>[{$key}:{$token}]</code> - {$info['name']}";
    }
    $output .= '<dd>' . theme('item_list', array(
      'items' => $token_pairs,
    )) . '</dd>';
  }
  $output .= '</dl>';
  return $output;
}