You are here

function page_title_form_node_type_form_alter in Page Title 7.2

Same name and namespace in other branches
  1. 8.2 page_title.module \page_title_form_node_type_form_alter()
  2. 6.2 page_title.module \page_title_form_node_type_form_alter()

Implement hook_form_FORM_ID_alter().

File

./page_title.module, line 304
Enhanced control over the page title (in the head tag).

Code

function page_title_form_node_type_form_alter(&$form, $form_state) {

  // If we dont have permission to administer the title then we need to abort this alter now!
  if (!user_access('administer page title')) {
    return;
  }

  // Add the node-type specific page title settings to the additional settings section
  $form['page_title'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page Title Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => TRUE,
    '#group' => 'additional_settings',
  );
  $form['page_title']['show_field'] = array(
    '#type' => 'checkboxes',
    '#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' => variable_get('page_title_type_' . $form['#node_type']->type . '_showfield', 0) ? array(
      'show_field',
    ) : array(),
  );
  $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/config/search/page-title'),
    )),
    '#maxlength' => 255,
  );
  $form['#submit'][] = 'page_title_node_type_form_submit';
}