Commit 7d107aa9 authored by Nicholas Thompson's avatar Nicholas Thompson
Browse files

More work to make Page Title compatible with Drupal 7

parent be083fc8
......@@ -117,7 +117,6 @@ function page_title_admin_settings() {
);
// Add the token help to a collapsed fieldset at the end of the configuration page.
/*
$form['token_help'] = array(
'#type' => 'fieldset',
'#title' => t('Available Tokens List'),
......@@ -125,9 +124,8 @@ function page_title_admin_settings() {
'#collapsed' => TRUE,
);
$form['token_help']['content'] = array(
'#type' => 'markup',
'#value' => theme('token_help'),
);*/
'#markup' => theme('page_title_token_help'),
);
$form = system_settings_form($form);
......@@ -158,3 +156,25 @@ function theme_page_title_admin_settings($variables) {
$output .= drupal_render_children($form);
return $output;
}
/**
* An internal theme function to render the tokens to help the user. NOTE: Why is this not a core theme function?!
*/
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;
}
......@@ -40,8 +40,17 @@ function page_title_help($path, $arg) {
/**
* Implement hook_perm().
*/
function page_title_perm() {
return array('set page title', 'administer page titles');
function page_title_permission() {
return array(
'set page title' => array(
'title' => t('Set Page Title'),
'description' => t('Allow user to set or modify a page title'),
),
'administer page titles' => array(
'title' => t('Administer Page Title'),
'description' => t('Perform administration tasks for Page Title'),
),
);
}
......@@ -74,7 +83,9 @@ function page_title_theme() {
'render element' => 'form',
'file' => 'page_title.admin.inc',
),
'page_title_token_help' => array(
'file' => 'page_title.admin.inc',
),
'page_title_preprocess_html' => array(
'arguments' => array('vars' => NULL),
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment