You are here

function print_main_settings in Printer, email and PDF versions 5

Same name and namespace in other branches
  1. 5.4 print.admin.inc \print_main_settings()
  2. 5.2 print.module \print_main_settings()
  3. 5.3 print.admin.inc \print_main_settings()
  4. 6 print.admin.inc \print_main_settings()
  5. 7.2 print.admin.inc \print_main_settings()
  6. 7 print.admin.inc \print_main_settings()
  7. 5.x print.admin.inc \print_main_settings()
1 string reference to 'print_main_settings'
print_menu in ./print.module
Implementation of hook_menu().

File

./print.module, line 107
Display printer friendly versions of nodes (except books)

Code

function print_main_settings() {
  $print_settings = variable_get('print_settings', print_settings_default());
  $form['print_settings'] = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
  );
  $form['print_settings']['show_link'] = array(
    '#type' => 'radios',
    '#title' => t('Printer-friendly page link'),
    '#default_value' => $print_settings['show_link'],
    '#options' => array(
      t("Disabled"),
      t("Enabled"),
    ),
    '#description' => t("Enable or disable the printer friendly page link for each node. Even if the link is disabled, you can still view the print version of a node by going to print/nid where nid is the numeric id of the node."),
  );
  $form['print_settings']['logo_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Logo URL'),
    '#default_value' => $print_settings['logo_url'],
    '#size' => 60,
    '#maxlength' => 250,
    '#description' => t('An alternative logo to display on the printer friendly version. If left empty, the current theme\'s logo is used.'),
  );
  $form['print_settings']['css'] = array(
    '#type' => 'textfield',
    '#title' => t('Stylesheet URL'),
    '#default_value' => $print_settings['css'],
    '#size' => 60,
    '#maxlength' => 64,
    '#description' => t('The URL to your custom print cascading stylesheet, if any. When none is specified, a set of default styles are used.'),
  );
  $form['print_settings']['urls'] = array(
    '#type' => 'checkbox',
    '#title' => t('Printer friendly URLs list'),
    '#return_value' => 1,
    '#default_value' => $print_settings['urls'],
    '#description' => t('If set, links in your page will be de-activated, and a list of the destination URLs will be displayed at the bottom of the page.'),
  );
  $form['print_settings']['newwindow'] = array(
    '#type' => 'checkbox',
    '#title' => t('Open the printer-friendly version in a new window'),
    '#return_value' => 1,
    '#default_value' => $print_settings['newwindow'],
    '#description' => t('Setting this option will make the printer-friendly version open in a new window/tab.'),
  );
  $form['print_settings']['sendtoprinter'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send to printer'),
    '#return_value' => 1,
    '#default_value' => $print_settings['sendtoprinter'],
    '#description' => t('Automatically calls the browser\'s print function when the printer-friendly version is displayed.'),
  );
  $print_sourceurl_settings = variable_get('print_sourceurl_settings', print_sourceurl_settings_default());
  $form['print_sourceurl_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Source URL'),
    '#collapsible' => true,
    '#collapsed' => true,
    '#tree' => true,
  );
  $form['print_sourceurl_settings']['enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display source URL'),
    '#return_value' => 1,
    '#default_value' => $print_sourceurl_settings['enabled'],
    '#description' => t('When this option is selected, the URL for the original page will be displayed at the bottom of the printer-friendly version.'),
  );
  $form['print_sourceurl_settings']['date'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add current time/date to the source URL'),
    '#return_value' => 1,
    '#default_value' => $print_sourceurl_settings['date'],
    '#description' => t('Display the current date and time in the Source URL line.'),
  );
  $form['print_sourceurl_settings']['forcenode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force use of node ID in source URL'),
    '#return_value' => 1,
    '#default_value' => $print_sourceurl_settings['forcenode'],
    '#description' => t('Drupal will attempt to use the page\'s defined alias in case there is one. To force the use of the fixed URL, activate this option.'),
  );
  $print_robot_settings = variable_get('print_robot_settings', print_robot_settings_default());
  $form['print_robot_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Robots META tags'),
    '#collapsible' => true,
    '#collapsed' => true,
    '#tree' => TRUE,
  );
  $form['print_robot_settings']['noindex'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add noindex'),
    '#return_value' => 1,
    '#default_value' => $print_robot_settings['noindex'],
    '#description' => t('Instruct robots to not index printer friendly pages. Recommended for good search engine karma.'),
  );
  $form['print_robot_settings']['nofollow'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add nofollow'),
    '#return_value' => 1,
    '#default_value' => $print_robot_settings['nofollow'],
    '#description' => t('Instruct robots to not follow outgoing links on printer friendly pages.'),
  );
  $form['print_robot_settings']['noarchive'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add noarchive'),
    '#return_value' => 1,
    '#default_value' => $print_robot_settings['noarchive'],
    '#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer friendly pages. Recognized by Googlebot.'),
  );
  $form['print_robot_settings']['nocache'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add nocache'),
    '#return_value' => 1,
    '#default_value' => $print_robot_settings['nocache'],
    '#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer friendly pages'),
  );
  return system_settings_form($form);
}