| Commit | Line | Data |
|---|---|---|
| ddb9ae21 JV |
1 | <?php |
| 2 | /* $Id$ */ | |
| 3 | ||
| 4 | //******************************************************************* | |
| 5 | // Admin Settings: Print | |
| 6 | //******************************************************************* | |
| 7 | ||
| 8 | /** | |
| 9 | * Print module settings form | |
| 10 | */ | |
| 11 | function print_main_settings() { | |
| 12 | $print_settings = variable_get('print_settings', print_settings_default()); | |
| 13 | ||
| 14 | $form['print_settings'] = array( | |
| 15 | '#type' => 'fieldset', | |
| 16 | '#tree' => TRUE, | |
| 17 | ); | |
| 18 | ||
| 19 | $form['print_settings']['show_link'] = array( | |
| 20 | '#type' => 'radios', | |
| 21 | '#title' => t('Printer-friendly page link'), | |
| 22 | '#default_value' => $print_settings['show_link'], | |
| 23 | '#options' => array(t("None (Disabled)"), t("Text only"), t("Icon only"), t("Icon and Text")), | |
| 24 | '#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."), | |
| 25 | ); | |
| 26 | ||
| 27 | $form['print_settings']['show_sys_link'] = array( | |
| 28 | '#type' => 'checkbox', | |
| 29 | '#title' => t('Show link in system (non-content) pages'), | |
| 30 | '#default_value' => $print_settings['show_sys_link'], | |
| 31 | '#description' => t('Setting this option will add a printer-friendly version page link on pages created by Drupal or the enabled modules.'), | |
| 32 | ); | |
| 33 | ||
| 34 | $form['print_settings']['book_link'] = array( | |
| 35 | '#type' => 'checkbox', | |
| 36 | '#title' => t('Take control of the book module printer-friendly link'), | |
| 37 | '#default_value' => $print_settings['book_link'], | |
| 38 | '#description' => t('Activate this to have the printer-friendly link in book nodes handled by this module. Requires the (core) book module.'), | |
| 39 | ); | |
| 40 | ||
| 41 | $form['print_settings']['logo_url'] = array( | |
| 42 | '#type' => 'textfield', | |
| 43 | '#title' => t('Logo URL'), | |
| 44 | '#default_value' => $print_settings['logo_url'], | |
| 45 | '#size' => 60, | |
| 46 | '#maxlength' => 250, | |
| 47 | '#description' => t('An alternative logo to display on the printer-friendly version. If left empty, the current theme\'s logo is used.'), | |
| 48 | ); | |
| 49 | ||
| 50 | $form['print_settings']['css'] = array( | |
| 51 | '#type' => 'textfield', | |
| 52 | '#title' => t('Stylesheet URL'), | |
| 53 | '#default_value' => $print_settings['css'], | |
| 54 | '#size' => 60, | |
| 55 | '#maxlength' => 64, | |
| 56 | '#description' => t('The URL to your custom print cascading stylesheet, if any. When none is specified, the default module CSS file is used.'), | |
| 57 | ); | |
| 58 | ||
| 59 | $form['print_settings']['urls'] = array( | |
| 60 | '#type' => 'checkbox', | |
| 61 | '#title' => t('Printer-friendly URLs list'), | |
| 62 | '#default_value' => $print_settings['urls'], | |
| 63 | '#description' => t('If set, a list of the destination URLs for the page links will be displayed at the bottom of the page.'), | |
| 64 | ); | |
| 65 | ||
| 66 | $form['print_settings']['comments'] = array( | |
| 67 | '#type' => 'checkbox', | |
| 68 | '#title' => t('Include comments in printer-friendly version'), | |
| 69 | '#default_value' => $print_settings['comments'], | |
| 70 | '#description' => t('When this option is active, user comments are also included in the printer-friendly version. Requires the comment module.'), | |
| 71 | ); | |
| 72 | ||
| 73 | $form['print_settings']['newwindow'] = array( | |
| 74 | '#type' => 'radios', | |
| 75 | '#title' => t('Open the printer-friendly version in a new window'), | |
| 76 | '#options' => array(t("Disabled"), t("Use HTML target (does not validate as XHTML Strict)"), t("Use Javascript (requires browser support)"), t("Use Greybox Redux (requires the greybox module)"), t("Use Thickbox (requires the thickbox module)")), | |
| 77 | '#default_value' => $print_settings['newwindow'], | |
| 78 | '#description' => t('Setting this option will make the printer-friendly version open in a new window/tab.'), | |
| 79 | ); | |
| 80 | ||
| 81 | $form['print_settings']['sendtoprinter'] = array( | |
| 82 | '#type' => 'checkbox', | |
| 83 | '#title' => t('Send to printer'), | |
| 84 | '#default_value' => $print_settings['sendtoprinter'], | |
| 85 | '#description' => t('Automatically calls the browser\'s print function when the printer-friendly version is displayed.'), | |
| 86 | ); | |
| 87 | ||
| 88 | $print_sourceurl_settings = variable_get('print_sourceurl_settings', print_sourceurl_settings_default()); | |
| 89 | ||
| 90 | $form['print_sourceurl_settings'] = array( | |
| 91 | '#type' => 'fieldset', | |
| 92 | '#title' => t('Source URL'), | |
| 93 | '#collapsible' => TRUE, | |
| 94 | '#collapsed' => TRUE, | |
| 95 | '#tree' => TRUE, | |
| 96 | ); | |
| 97 | ||
| 98 | $form['print_sourceurl_settings']['enabled'] = array( | |
| 99 | '#type' => 'checkbox', | |
| 100 | '#title' => t('Display source URL'), | |
| 101 | '#default_value' => $print_sourceurl_settings['enabled'], | |
| 102 | '#description' => t('When this option is selected, the URL for the original page will be displayed at the bottom of the printer-friendly version.'), | |
| 103 | ); | |
| 104 | ||
| 105 | $form['print_sourceurl_settings']['date'] = array( | |
| 106 | '#type' => 'checkbox', | |
| 107 | '#title' => t('Add current time/date to the source URL'), | |
| 108 | '#default_value' => $print_sourceurl_settings['date'], | |
| 109 | '#description' => t('Display the current date and time in the Source URL line.'), | |
| 110 | ); | |
| 111 | ||
| 112 | $form['print_sourceurl_settings']['forcenode'] = array( | |
| 113 | '#type' => 'checkbox', | |
| 114 | '#title' => t('Force use of node ID in source URL'), | |
| 115 | '#default_value' => $print_sourceurl_settings['forcenode'], | |
| 116 | '#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.'), | |
| 117 | ); | |
| 118 | ||
| 119 | $print_robot_settings = variable_get('print_robot_settings', print_robot_settings_default()); | |
| 120 | ||
| 121 | $form['print_robot_settings'] = array( | |
| 122 | '#type' => 'fieldset', | |
| 123 | '#title' => t('Robots META tags'), | |
| 124 | '#collapsible' => TRUE, | |
| 125 | '#collapsed' => TRUE, | |
| 126 | '#tree' => TRUE, | |
| 127 | ); | |
| 128 | ||
| 129 | $form['print_robot_settings']['noindex'] = array( | |
| 130 | '#type' => 'checkbox', | |
| 131 | '#title' => t('Add noindex'), | |
| 132 | '#default_value' => $print_robot_settings['noindex'], | |
| 133 | '#description' => t('Instruct robots to not index printer-friendly pages. Recommended for good search engine karma.'), | |
| 134 | ); | |
| 135 | ||
| 136 | $form['print_robot_settings']['nofollow'] = array( | |
| 137 | '#type' => 'checkbox', | |
| 138 | '#title' => t('Add nofollow'), | |
| 139 | '#default_value' => $print_robot_settings['nofollow'], | |
| 140 | '#description' => t('Instruct robots to not follow outgoing links on printer-friendly pages.'), | |
| 141 | ); | |
| 142 | ||
| 143 | $form['print_robot_settings']['noarchive'] = array( | |
| 144 | '#type' => 'checkbox', | |
| 145 | '#title' => t('Add noarchive'), | |
| 146 | '#default_value' => $print_robot_settings['noarchive'], | |
| 147 | '#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer-friendly pages. Recognized by Googlebot.'), | |
| 148 | ); | |
| 149 | ||
| 150 | $form['print_robot_settings']['nocache'] = array( | |
| 151 | '#type' => 'checkbox', | |
| 152 | '#title' => t('Add nocache'), | |
| 153 | '#default_value' => $print_robot_settings['nocache'], | |
| 154 | '#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer-friendly pages'), | |
| 155 | ); | |
| 156 | ||
| 157 | //Visibility API module | |
| 158 | if (module_exists('visibility_api')) { | |
| 159 | visibility_api_form_configuration('print', $form['general']); | |
| 160 | } | |
| 161 | ||
| 162 | return system_settings_form($form); | |
| 163 | } |