function page_title_form_alter in Page Title 6
Same name and namespace in other branches
- 8.2 page_title.module \page_title_form_alter()
- 5.2 page_title.module \page_title_form_alter()
- 5 page_title.module \page_title_form_alter()
- 6.2 page_title.module \page_title_form_alter()
- 7.2 page_title.module \page_title_form_alter()
- 7 page_title.module \page_title_form_alter()
Implementation of hook_form_alter().
File
- ./
page_title.module, line 195 - Enhanced control over the page title (in the head tag).
Code
function page_title_form_alter(&$form, $form_state, $form_id) {
//If we dont have permission to set the title then we need to abort this alter now!
if (!user_access('set page title')) {
return;
}
$display = variable_get('page_title_display', array());
//Check we're editing a node form and also check that the node type 'value' is enabled
if ($form['#id'] == 'node-form' && $display[$form['type']['#value']]) {
$form['page_title'] = array(
'#type' => 'textfield',
'#title' => t('Page title'),
'#description' => t('Optionally specify a different title to appear in the <title> tag of the page.'),
'#default_value' => $form['#node']->page_title,
'#size' => 60,
'#maxlength' => 255,
'#weight' => -4,
);
}
}