Commit 22e9fa24 authored by jcnventura's avatar jcnventura

Issue #1423056 by ptaff: add configuration setting to include theme CSS files.

parent dd2e5513
......@@ -42,6 +42,13 @@ function print_main_settings() {
'#disabled' => !user_access('administer site configuration'),
);
$form['settings']['print_keep_theme_css'] = array(
'#type' => 'checkbox',
'#title' => t('Keep the current theme CSS'),
'#default_value' => variable_get('print_keep_theme_css', PRINT_KEEP_THEME_CSS_DEFAULT),
'#description' => t('If set, the current theme css will still be applied to the printer-friendly versions.'),
);
$form['settings']['print_urls'] = array(
'#type' => 'checkbox',
'#title' => t('Printer-friendly URLs list'),
......
......@@ -44,6 +44,7 @@ function print_uninstall() {
variable_del('print_logo_url');
variable_del('print_logo_options');
variable_del('print_css');
variable_del('print_keep_theme_css');
variable_del('print_urls');
variable_del('print_urls_anchors');
variable_del('print_comments');
......
......@@ -46,6 +46,7 @@ define('PRINT_LOGO_URL_DEFAULT', '');
define('PRINT_FOOTER_OPTIONS_DEFAULT', 1);
define('PRINT_FOOTER_USER_DEFAULT', '');
define('PRINT_CSS_DEFAULT', '');
define('PRINT_KEEP_THEME_CSS_DEFAULT', 0);
define('PRINT_URLS_DEFAULT', 1);
define('PRINT_URLS_ANCHORS_DEFAULT', 0);
define('PRINT_COMMENTS_DEFAULT', 0);
......
......@@ -156,6 +156,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
// print module settings
$print_css = variable_get('print_css', PRINT_CSS_DEFAULT);
$print_keep_theme_css = variable_get('print_keep_theme_css', PRINT_KEEP_THEME_CSS_DEFAULT);
$print_logo_options = variable_get('print_logo_options', PRINT_LOGO_OPTIONS_DEFAULT);
$print_logo_url = variable_get('print_logo_url', PRINT_LOGO_URL_DEFAULT);
$print_html_new_window = variable_get('print_html_new_window', PRINT_HTML_NEW_WINDOW_DEFAULT);
......@@ -187,10 +188,12 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
drupal_add_css(drupal_get_path('module', 'print') . '/css/print.css');
}
$drupal_css = drupal_add_css();
foreach ($drupal_css as $key => $css_file) {
if ($css_file['group'] == CSS_THEME) {
// Unset the theme's CSS
unset($drupal_css[$key]);
if (!$print_keep_theme_css) {
foreach ($drupal_css as $key => $css_file) {
if ($css_file['group'] == CSS_THEME) {
// Unset the theme's CSS
unset($drupal_css[$key]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment