Commit 43e2ecac authored by Nicholas Thompson's avatar Nicholas Thompson
Browse files

Tweak to the node edit form page title settings to make it consistend with the...

Tweak to the node edit form page title settings to make it consistend with the DRUPAL-6--2 implementation
parent 28db2611
......@@ -54,6 +54,7 @@ function page_title_uninstall() {
variable_del('page_title_default');
variable_del('page_title_individual');
variable_del('page_title_front');
variable_del('page_title_blog');
variable_del('page_title_user');
variable_del('page_title_user_showfield');
variable_del('page_title_pager_pattern');
......
......@@ -151,15 +151,27 @@ function page_title_form_alter($form_id, &$form) {
}
}
elseif ($form_id == 'node_type_form') {
$key = 'page_title_type_'. $form['#node_type']->type .'_showfield';
$form['workflow']['page_title_field'] = array(
$form['page_title'] = array(
'#type' => 'fieldset',
'#title' => t('Page Title Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
);
$form['page_title']['show_field'] = array(
'#type' => 'checkboxes',
'#title' => t('Page title field'),
'#title' => t('Page Title Field'),
'#description' => t('If checked, the <em>Page Title</em> field will appear on the node edit form for those who have permission to set the title.'),
'#options' => array(
'show_field' => t('Show field'),
),
'#default_value' => array('show_field' => variable_get($key, 0) ? 'show_field' : 0),
'#default_value' => array('show_field' => variable_get('page_title_type_'. $form['#node_type']->type .'_showfield', 0) ? 'show_field' : 0),
);
$form['page_title']['pattern'] = array(
'#type' => 'textfield',
'#title' => t('Page Title Pattern'),
'#default_value' => variable_get('page_title_type_'. $form['#node_type']->type, ''),
'#description' => t('Enter the <em>Page Title</em> pattern you want to use for this node type. For more information, please use the !link settings page', array('!link' => l('Page Title', 'admin/content/page_title'))),
);
$form['#submit']['page_title_node_type_form_submit'] = array();
}
......@@ -170,8 +182,12 @@ function page_title_form_alter($form_id, &$form) {
* Submite handler for the node_type_form element added in the hook_form_alter() above.
*/
function page_title_node_type_form_submit($form_id, $form_values) {
$v = $form_values['page_title_field']['show_field'] ? 1 : 0;
variable_set('page_title_type_'. $form_values['type'] .'_showfield', $v);
$show_field = $form_values['page_title']['show_field']['show_field'] ? 1 : 0;
variable_set('page_title_type_'. $form_values['type'] .'_showfield', $show_field);
variable_set('page_title_type_'. $form_values['type'], $form_values['page_title']['pattern']);
// For some reason the node module adds the fieldset as a separate entry in the variables table... we dont want this!
variable_del('page_title_'. $form_values['type']);
}
......
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