| Commit | Line | Data |
|---|---|---|
| ddb9ae21 | 1 | <?php |
| 623692c4 | 2 | // $Id$ |
| ddb9ae21 | 3 | |
| 623692c4 JV |
4 | /** |
| 5 | * @file | |
| 6 | * Contains the administrative functions of the PF module. | |
| 7 | * | |
| 8 | * This file is included by the core PF module, and includes the | |
| 9 | * settings form. | |
| 10 | */ | |
| ddb9ae21 JV |
11 | |
| 12 | /** | |
| 623692c4 JV |
13 | * Menu callback for the Printer-friendly pages module settings form. |
| 14 | * | |
| 15 | * @ingroup forms | |
| ddb9ae21 JV |
16 | */ |
| 17 | function print_main_settings() { | |
| 18 | $print_settings = variable_get('print_settings', print_settings_default()); | |
| 95076d9f | 19 | |
| ddb9ae21 JV |
20 | $form['print_settings'] = array( |
| 21 | '#type' => 'fieldset', | |
| 22 | '#tree' => TRUE, | |
| 23 | ); | |
| 24 | ||
| 25 | $form['print_settings']['show_link'] = array( | |
| 26 | '#type' => 'radios', | |
| 27 | '#title' => t('Printer-friendly page link'), | |
| 28 | '#default_value' => $print_settings['show_link'], | |
| 29 | '#options' => array(t("None (Disabled)"), t("Text only"), t("Icon only"), t("Icon and Text")), | |
| 30 | '#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."), | |
| 31 | ); | |
| 32 | ||
| 6ee36e8a JV |
33 | $form['print_settings']['node_link_visibility'] = array( |
| 34 | '#type' => 'radios', | |
| 35 | '#title' => t('Link visibility'), | |
| 36 | '#default_value' => $print_settings['node_link_visibility'], | |
| 37 | '#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')), | |
| 38 | ); | |
| 39 | ||
| 40 | $form['print_settings']['node_link_pages'] = array( | |
| 41 | '#type' => 'textarea', | |
| 42 | '#default_value' => $print_settings['node_link_pages'], | |
| 43 | '#rows' => 3, | |
| 44 | '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')), | |
| 45 | ); | |
| 46 | ||
| 9f9f3f56 JV |
47 | $form['print_settings']['link_class'] = array( |
| 48 | '#type' => 'textfield', | |
| 49 | '#title' => t('Link class'), | |
| 50 | '#default_value' => $print_settings['link_class'], | |
| 51 | '#size' => 60, | |
| 52 | '#maxlength' => 250, | |
| 53 | '#description' => t('This can be used by themers to change the link style or by jQuery modules to open in a new window (e.g. greybox or thickbox). Multiple classes can be specified, separated by spaces.'), | |
| 54 | ); | |
| 55 | ||
| 6ee36e8a JV |
56 | $form['print_settings']['sys_link_visibility'] = array( |
| 57 | '#type' => 'radios', | |
| ddb9ae21 | 58 | '#title' => t('Show link in system (non-content) pages'), |
| 6ee36e8a JV |
59 | '#default_value' => $print_settings['sys_link_visibility'], |
| 60 | '#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')), | |
| 61 | ); | |
| 62 | ||
| 63 | $form['print_settings']['sys_link_pages'] = array( | |
| 64 | '#type' => 'textarea', | |
| 65 | '#default_value' => $print_settings['sys_link_pages'], | |
| 66 | '#rows' => 3, | |
| 67 | '#description' => t("Setting this option will add a printer-friendly version page link on pages created by Drupal or the enabled modules.") .'<br />'. | |
| 68 | t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')), | |
| ddb9ae21 JV |
69 | ); |
| 70 | ||
| 71 | $form['print_settings']['book_link'] = array( | |
| 72 | '#type' => 'checkbox', | |
| 73 | '#title' => t('Take control of the book module printer-friendly link'), | |
| 74 | '#default_value' => $print_settings['book_link'], | |
| 75 | '#description' => t('Activate this to have the printer-friendly link in book nodes handled by this module. Requires the (core) book module.'), | |
| 76 | ); | |
| 77 | ||
| 78 | $form['print_settings']['logo_url'] = array( | |
| 79 | '#type' => 'textfield', | |
| 80 | '#title' => t('Logo URL'), | |
| 81 | '#default_value' => $print_settings['logo_url'], | |
| 82 | '#size' => 60, | |
| 83 | '#maxlength' => 250, | |
| 84 | '#description' => t('An alternative logo to display on the printer-friendly version. If left empty, the current theme\'s logo is used.'), | |
| 85 | ); | |
| 86 | ||
| 87 | $form['print_settings']['css'] = array( | |
| 88 | '#type' => 'textfield', | |
| 89 | '#title' => t('Stylesheet URL'), | |
| 90 | '#default_value' => $print_settings['css'], | |
| 91 | '#size' => 60, | |
| 92 | '#maxlength' => 64, | |
| 37f3c1f9 JV |
93 | '#description' => t('The URL to your custom print cascading stylesheet, if any. When none is specified, the default module CSS file is used.') .'<br />'. |
| 94 | t('Macros: %b (base path: "%base"), %t (path to theme: "%theme")', array('%base' => base_path(), '%theme' => path_to_theme())), | |
| ddb9ae21 JV |
95 | ); |
| 96 | ||
| 97 | $form['print_settings']['urls'] = array( | |
| 98 | '#type' => 'checkbox', | |
| 99 | '#title' => t('Printer-friendly URLs list'), | |
| 100 | '#default_value' => $print_settings['urls'], | |
| 101 | '#description' => t('If set, a list of the destination URLs for the page links will be displayed at the bottom of the page.'), | |
| 102 | ); | |
| 103 | ||
| 104 | $form['print_settings']['comments'] = array( | |
| 105 | '#type' => 'checkbox', | |
| 106 | '#title' => t('Include comments in printer-friendly version'), | |
| 107 | '#default_value' => $print_settings['comments'], | |
| 108 | '#description' => t('When this option is active, user comments are also included in the printer-friendly version. Requires the comment module.'), | |
| 109 | ); | |
| 110 | ||
| 9f9f3f56 JV |
111 | $form['print_settings']['new_window'] = array( |
| 112 | '#type' => 'checkbox', | |
| 113 | '#title' => t('Open the printer-friendly version in a new window'), | |
| 114 | '#default_value' => $print_settings['new_window'], | |
| 115 | '#description' => t('Setting this option will make the printer-friendly version open in a new window/tab.'), | |
| 116 | ); | |
| 117 | ||
| ddb9ae21 JV |
118 | $form['print_settings']['newwindow'] = array( |
| 119 | '#type' => 'radios', | |
| 9f9f3f56 JV |
120 | '#title' => t('New window method'), |
| 121 | '#options' => array(t("Use HTML target (does not validate as XHTML Strict)"), t("Use Javascript (requires browser support)")), | |
| ddb9ae21 | 122 | '#default_value' => $print_settings['newwindow'], |
| 9f9f3f56 | 123 | '#description' => t('Choose the method used to open pages in a new window/tab.'), |
| ddb9ae21 JV |
124 | ); |
| 125 | ||
| 126 | $form['print_settings']['sendtoprinter'] = array( | |
| 127 | '#type' => 'checkbox', | |
| 128 | '#title' => t('Send to printer'), | |
| 129 | '#default_value' => $print_settings['sendtoprinter'], | |
| 130 | '#description' => t('Automatically calls the browser\'s print function when the printer-friendly version is displayed.'), | |
| 131 | ); | |
| 132 | ||
| 133 | $print_sourceurl_settings = variable_get('print_sourceurl_settings', print_sourceurl_settings_default()); | |
| 134 | ||
| 135 | $form['print_sourceurl_settings'] = array( | |
| 136 | '#type' => 'fieldset', | |
| 137 | '#title' => t('Source URL'), | |
| 138 | '#collapsible' => TRUE, | |
| 139 | '#collapsed' => TRUE, | |
| 140 | '#tree' => TRUE, | |
| 141 | ); | |
| 142 | ||
| 143 | $form['print_sourceurl_settings']['enabled'] = array( | |
| 144 | '#type' => 'checkbox', | |
| 145 | '#title' => t('Display source URL'), | |
| 146 | '#default_value' => $print_sourceurl_settings['enabled'], | |
| 147 | '#description' => t('When this option is selected, the URL for the original page will be displayed at the bottom of the printer-friendly version.'), | |
| 148 | ); | |
| 149 | ||
| 150 | $form['print_sourceurl_settings']['date'] = array( | |
| 151 | '#type' => 'checkbox', | |
| 152 | '#title' => t('Add current time/date to the source URL'), | |
| 153 | '#default_value' => $print_sourceurl_settings['date'], | |
| 154 | '#description' => t('Display the current date and time in the Source URL line.'), | |
| 155 | ); | |
| 156 | ||
| 157 | $form['print_sourceurl_settings']['forcenode'] = array( | |
| 158 | '#type' => 'checkbox', | |
| 159 | '#title' => t('Force use of node ID in source URL'), | |
| 160 | '#default_value' => $print_sourceurl_settings['forcenode'], | |
| 161 | '#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.'), | |
| 162 | ); | |
| 163 | ||
| 164 | $print_robot_settings = variable_get('print_robot_settings', print_robot_settings_default()); | |
| 165 | ||
| 166 | $form['print_robot_settings'] = array( | |
| 167 | '#type' => 'fieldset', | |
| 168 | '#title' => t('Robots META tags'), | |
| 169 | '#collapsible' => TRUE, | |
| 170 | '#collapsed' => TRUE, | |
| 171 | '#tree' => TRUE, | |
| 172 | ); | |
| 173 | ||
| 174 | $form['print_robot_settings']['noindex'] = array( | |
| 175 | '#type' => 'checkbox', | |
| 176 | '#title' => t('Add noindex'), | |
| 177 | '#default_value' => $print_robot_settings['noindex'], | |
| 178 | '#description' => t('Instruct robots to not index printer-friendly pages. Recommended for good search engine karma.'), | |
| 179 | ); | |
| 180 | ||
| 181 | $form['print_robot_settings']['nofollow'] = array( | |
| 182 | '#type' => 'checkbox', | |
| 183 | '#title' => t('Add nofollow'), | |
| 184 | '#default_value' => $print_robot_settings['nofollow'], | |
| 185 | '#description' => t('Instruct robots to not follow outgoing links on printer-friendly pages.'), | |
| 186 | ); | |
| 187 | ||
| 188 | $form['print_robot_settings']['noarchive'] = array( | |
| 189 | '#type' => 'checkbox', | |
| 190 | '#title' => t('Add noarchive'), | |
| 191 | '#default_value' => $print_robot_settings['noarchive'], | |
| 192 | '#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer-friendly pages. Recognized by Googlebot.'), | |
| 193 | ); | |
| 194 | ||
| ddb9ae21 JV |
195 | return system_settings_form($form); |
| 196 | } |