| 1 |
<?php |
<?php |
| 2 |
// $Id: page_title.admin.inc,v 1.2 2009/08/15 22:06:17 njt1982 Exp $ |
// $Id: page_title.admin.inc,v 1.3 2009/10/29 18:11:19 njt1982 Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 117 |
); |
); |
| 118 |
|
|
| 119 |
// Add the token help to a collapsed fieldset at the end of the configuration page. |
// Add the token help to a collapsed fieldset at the end of the configuration page. |
|
/* |
|
| 120 |
$form['token_help'] = array( |
$form['token_help'] = array( |
| 121 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 122 |
'#title' => t('Available Tokens List'), |
'#title' => t('Available Tokens List'), |
| 124 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 125 |
); |
); |
| 126 |
$form['token_help']['content'] = array( |
$form['token_help']['content'] = array( |
| 127 |
'#type' => 'markup', |
'#markup' => theme('page_title_token_help'), |
| 128 |
'#value' => theme('token_help'), |
); |
|
);*/ |
|
| 129 |
|
|
| 130 |
|
|
| 131 |
$form = system_settings_form($form); |
$form = system_settings_form($form); |
| 156 |
$output .= drupal_render_children($form); |
$output .= drupal_render_children($form); |
| 157 |
return $output; |
return $output; |
| 158 |
} |
} |
| 159 |
|
|
| 160 |
|
|
| 161 |
|
/** |
| 162 |
|
* An internal theme function to render the tokens to help the user. NOTE: Why is this not a core theme function?! |
| 163 |
|
*/ |
| 164 |
|
function theme_page_title_token_help() { |
| 165 |
|
$token_info = token_info(); |
| 166 |
|
|
| 167 |
|
$output = '<p>'. t('Available tokens are:') .'</p>'; |
| 168 |
|
$output .= '<dl>'; |
| 169 |
|
// TODO: Sort out user:user token help... we cant do nested tokens this way. Recursive token_help theme function needed? |
| 170 |
|
foreach(array('node', 'term', 'vocabulary', 'site', 'date') as $key) { |
| 171 |
|
$output .= "<dt><strong>{$token_info['types'][$key]['name']}</strong> - {$token_info['types'][$key]['description']}</dt>"; |
| 172 |
|
$token_pairs = array(); |
| 173 |
|
foreach ($token_info['tokens'][$key] as $token => $info) { |
| 174 |
|
$token_pairs[] = "<code>[{$key}:{$token}]</code> - {$info['name']}"; |
| 175 |
|
} |
| 176 |
|
$output .= '<dd>'. theme('item_list', array('items' => $token_pairs)) .'</dd>'; |
| 177 |
|
} |
| 178 |
|
$output .= '</dl>'; |
| 179 |
|
return $output; |
| 180 |
|
} |