You are here

function print_form_alter in Printer, email and PDF versions 5.2

Same name and namespace in other branches
  1. 5.4 print.module \print_form_alter()
  2. 5 print.module \print_form_alter()
  3. 5.3 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 115
Display 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 ('node_type_form' == $form_id) {
    $form['workflow']['print_display'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show printer-friendly version link'),
      '#return_value' => 1,
      '#default_value' => variable_get('print_display_' . $form['#node_type']->type, '1'),
      '#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'),
      )),
    );
  }
  elseif ('comment_admin_settings' == $form_id) {
    $form['viewing_options']['print_display_comment'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show printer-friendly version link in individual comments'),
      '#return_value' => 1,
      '#default_value' => variable_get('print_display_comment', '0'),
      '#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'),
      )),
    );
  }
}