You are here

function print_form_alter in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 5.4 print.module \print_form_alter()
  2. 5 print.module \print_form_alter()
  3. 5.2 print.module \print_form_alter()
  4. 6 print.module \print_form_alter()
  5. 7 print.module \print_form_alter()
  6. 5.x print.module \print_form_alter()

Implementation of hook_form_alter().

File

./print.module, line 244
Displays Printer-friendly versions of Drupal pages.

Code

function print_form_alter($form_id, &$form) {

  // Add the node-type settings option to activate the printer-friendly version link
  if ($form_id == 'node_type_form') {
    $form['print'] = array(
      '#type' => 'fieldset',
      '#title' => t('Printer, e-mail and PDF versions'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['print']['print_display'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show printer-friendly version link'),
      '#default_value' => variable_get('print_display_' . $form['#node_type']->type, PRINT_TYPE_SHOW_LINK_DEFAULT),
      '#description' => t('Displays the link to a printer-friendly version of the content. Further configuration is available on the !settings.', array(
        '!settings' => l(t('settings page'), 'admin/settings/print'),
      )),
    );
    $form['print']['print_display_comment'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show printer-friendly version link in individual comments'),
      '#default_value' => variable_get('print_display_comment_' . $form['#node_type']->type, PRINT_TYPE_COMMENT_LINK_DEFAULT),
      '#description' => t('Displays the link to a printer-friendly version of the comment. Further configuration is available on the !settings.', array(
        '!settings' => l(t('settings page'), 'admin/settings/print'),
      )),
    );
  }
}