Newer
Older
/**
* @file
* Contains the administrative functions of the PF module.
*
* This file is included by the core PF module, and includes the
* settings form.
*/
* Menu callback for the Printer-friendly pages module settings form.
*
* @ingroup forms
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
*/
function print_main_settings() {
$print_settings = variable_get('print_settings', print_settings_default());
$form['print_settings'] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
);
$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, the default module CSS file is used.'),
);
$form['print_settings']['urls'] = array(
'#type' => 'checkbox',
'#title' => t('Printer-friendly URLs list'),
'#default_value' => $print_settings['urls'],
'#description' => t('If set, a list of the destination URLs for the page links will be displayed at the bottom of the page.'),
);
$form['print_settings']['comments'] = array(
'#type' => 'checkbox',
'#title' => t('Include comments in printer-friendly version'),
'#default_value' => $print_settings['comments'],
'#description' => t('When this option is active, user comments are also included in the printer-friendly version. Requires the comment module.'),
);
$form['print_settings']['newwindow'] = array(
'#type' => 'radios',
João Ventura
committed
'#title' => t('New window method'),
'#options' => array(t("Use HTML target (does not validate as XHTML Strict)"), t("Use Javascript (requires browser support)")),
João Ventura
committed
'#description' => t('Choose the method used to open pages in a new window/tab.'),
);
$print_sourceurl_settings = variable_get('print_sourceurl_settings', print_sourceurl_settings_default());
$form['print_sourceurl_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Source URL'),
João Ventura
committed
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
);
$form['print_sourceurl_settings']['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Display source URL'),
'#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'),
'#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'),
'#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.'),
);
return system_settings_form($form);
}
function print_html_settings() {
$print_html_settings = variable_get('print_html_settings', print_html_settings_default());
$form['print_html_settings'] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
);
$form['print_html_settings']['show_link'] = array(
'#type' => 'radios',
'#title' => t('Printer-friendly page link'),
'#default_value' => $print_html_settings['show_link'],
'#options' => array(t("None (Disabled)"), t("Text only"), t("Icon only"), t("Icon and Text")),
'#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_html_settings']['node_link_visibility'] = array(
'#type' => 'radios',
'#title' => t('Link visibility'),
'#default_value' => $print_html_settings['node_link_visibility'],
'#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')),
);
$form['print_html_settings']['node_link_pages'] = array(
'#type' => 'textarea',
'#default_value' => $print_html_settings['node_link_pages'],
'#rows' => 3,
'#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>')),
);
$form['print_html_settings']['link_class'] = array(
'#type' => 'textfield',
'#title' => t('Link class'),
'#default_value' => $print_html_settings['link_class'],
'#size' => 60,
'#maxlength' => 250,
'#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.'),
);
$form['print_html_settings']['sys_link_visibility'] = array(
'#type' => 'radios',
'#title' => t('Show link in system (non-content) pages'),
'#default_value' => $print_html_settings['sys_link_visibility'],
'#options' => array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')),
);
$form['print_html_settings']['sys_link_pages'] = array(
'#type' => 'textarea',
'#default_value' => $print_html_settings['sys_link_pages'],
'#rows' => 3,
'#description' => t("Setting this option will add a printer-friendly version page link on pages created by Drupal or the enabled modules.") .'<br />'.
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>')),
);
$form['print_html_settings']['book_link'] = array(
'#type' => 'checkbox',
'#title' => t('Take control of the book module printer-friendly link'),
'#default_value' => $print_html_settings['book_link'],
'#description' => t('Activate this to have the printer-friendly link in book nodes handled by this module. Requires the (core) book module.'),
);
João Ventura
committed
$form['print_html_settings']['new_window'] = array(
'#type' => 'checkbox',
'#title' => t('Open the printer-friendly version in a new window'),
'#default_value' => $print_html_settings['new_window'],
'#description' => t('Setting this option will make the printer-friendly version open in a new window/tab.'),
);
$form['print_html_settings']['sendtoprinter'] = array(
'#type' => 'checkbox',
'#title' => t('Send to printer'),
'#default_value' => $print_html_settings['sendtoprinter'],
'#description' => t('Automatically calls the browser\'s print function when the printer-friendly version is displayed.'),
);
$print_robot_settings = variable_get('print_robot_settings', print_robot_settings_default());
$form['print_robot_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Robots META tags'),
João Ventura
committed
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
$form['print_robot_settings']['noindex'] = array(
'#type' => 'checkbox',
'#title' => t('Add noindex'),
'#default_value' => $print_robot_settings['noindex'],
João Ventura
committed
'#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'),
'#default_value' => $print_robot_settings['nofollow'],
João Ventura
committed
'#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'),
'#default_value' => $print_robot_settings['noarchive'],
João Ventura
committed
'#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer-friendly pages. Recognized by Googlebot.'),