Commit 96b9d512 authored by Dries's avatar Dries

- Patch #228818 by effulgentsia, JonathanRoberts: IE stylesheets ignored after 31 link/style tags.

parent 6d7e7bb8
This diff is collapsed.
......@@ -2483,8 +2483,8 @@ function theme_get_suggestions($args, $base, $delimiter = '__') {
}
/**
* The variables generated here is a mirror of template_preprocess_page().
* This preprocessor will run it's course when theme_maintenance_page() is
* The variables array generated here is a mirror of template_preprocess_page().
* This preprocessor will run its course when theme_maintenance_page() is
* invoked. It is also used in theme_install_page() and theme_update_page() to
* keep all the variables consistent.
*
......@@ -2545,7 +2545,6 @@ function template_preprocess_maintenance_page(&$variables) {
$variables['front_page'] = url();
$variables['breadcrumb'] = '';
$variables['feed_icons'] = '';
$variables['head'] = drupal_get_html_head();
$variables['help'] = '';
$variables['language'] = $language;
$variables['language']->dir = $language->direction ? 'rtl' : 'ltr';
......@@ -2555,9 +2554,6 @@ function template_preprocess_maintenance_page(&$variables) {
$variables['secondary_menu'] = array();
$variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
$variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '');
$variables['css'] = drupal_add_css();
$variables['styles'] = drupal_get_css();
$variables['scripts'] = drupal_get_js();
$variables['tabs'] = '';
$variables['title'] = drupal_get_title();
$variables['closure'] = '';
......@@ -2584,6 +2580,21 @@ function template_preprocess_maintenance_page(&$variables) {
}
}
/**
* The variables array generated here is a mirror of template_process_html().
* This processor will run its course when theme_maintenance_page() is invoked.
* It is also used in theme_install_page() and theme_update_page() to keep all
* the variables consistent.
*
* @see maintenance-page.tpl.php
*/
function template_process_maintenance_page(&$variables) {
$variables['head'] = drupal_get_html_head();
$variables['css'] = drupal_add_css();
$variables['styles'] = drupal_get_css();
$variables['scripts'] = drupal_get_js();
}
/**
* Preprocess variables for region.tpl.php
*
......
......@@ -137,6 +137,7 @@ function theme_install_page($variables) {
template_preprocess($variables, 'install_page');
template_preprocess_maintenance_page($variables);
template_process($variables, 'install_page');
template_process_maintenance_page($variables);
// Special handling of error messages
$messages = drupal_set_message();
......@@ -197,6 +198,7 @@ function theme_update_page($variables) {
template_preprocess($variables, 'update_page');
template_preprocess_maintenance_page($variables);
template_process($variables, 'update_page');
template_process_maintenance_page($variables);
// Special handling of warning messages.
$messages = drupal_set_message();
......
......@@ -558,7 +558,9 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css = 'http://example.com/style.css';
drupal_add_css($css, 'external');
$styles = drupal_get_css();
$this->assertTrue(strpos($styles, 'href="' . $css) > 0, t('Rendering an external CSS file.'));
// Stylesheet URL may be the href of a LINK tag or in an @import statement
// of a STYLE tag.
$this->assertTrue(strpos($styles, 'href="' . $css) > 0 || strpos($styles, '@import url("' . $css . '")') > 0, t('Rendering an external CSS file.'));
}
/**
......@@ -566,10 +568,10 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
*/
function testRenderInlinePreprocess() {
$css = 'body { padding: 0px; }';
$css_preprocessed = '<style type="text/css">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
$css_preprocessed = '<style type="text/css" media="all">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
drupal_add_css($css, 'inline');
$styles = drupal_get_css();
$this->assertEqual($styles, "\n" . $css_preprocessed . "\n", t('Rendering preprocessed inline CSS adds it to the page.'));
$this->assertEqual(trim($styles), $css_preprocessed, t('Rendering preprocessed inline CSS adds it to the page.'));
}
/**
......@@ -631,8 +633,10 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$styles = drupal_get_css();
if (preg_match_all('/href="' . preg_quote($GLOBALS['base_url'] . '/', '/') . '([^?]+)\?/', $styles, $matches)) {
$result = $matches[1];
// Stylesheet URL may be the href of a LINK tag or in an @import statement
// of a STYLE tag.
if (preg_match_all('/(href="|url\(")' . preg_quote($GLOBALS['base_url'] . '/', '/') . '([^?]+)\?/', $styles, $matches)) {
$result = $matches[2];
}
else {
$result = array();
......
......@@ -311,12 +311,18 @@ function system_element_info() {
$types['ajax_commands'] = array(
'#ajax_commands' => array(),
);
$types['html_tag'] = array(
'#theme' => 'html_tag',
'#pre_render' => array('drupal_pre_render_conditional_comments'),
'#attributes' => array(),
'#value' => NULL,
);
$types['styles'] = array(
'#items' => array(),
'#pre_render' => array('drupal_pre_render_styles'),
'#group_callback' => 'drupal_group_css',
'#aggregate_callback' => 'drupal_aggregate_css',
);
// Input elements.
$types['submit'] = array(
......
......@@ -20,9 +20,6 @@
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<!--[if lt IE 7]>
<?php print garland_get_ie_styles(); ?>
<![endif]-->
</head>
<body class="<?php print $classes ?>">
......
......@@ -25,10 +25,12 @@ function garland_breadcrumb($variables) {
* Override or insert variables into the maintenance page template.
*/
function garland_preprocess_maintenance_page(&$vars) {
// Toggle fixed or fluid width.
if (theme_get_setting('garland_width') == 'fluid') {
$vars['classes_array'][] = 'fluid-width';
}
// While markup for normal pages is split into page.tpl.php and html.tpl.php,
// the markup for the maintenance page is all in the single
// maintenance-page.tpl.php template. So, to have what's done in
// garland_preprocess_html() also happen on the maintenance page, it has to be
// called here.
garland_preprocess_html($vars);
}
/**
......@@ -39,6 +41,8 @@ function garland_preprocess_html(&$vars) {
if (theme_get_setting('garland_width') == 'fluid') {
$vars['classes_array'][] = 'fluid-width';
}
// Add conditional CSS for IE6.
drupal_add_css(path_to_theme() . '/fix-ie.css', array('weight' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
}
/**
......@@ -49,7 +53,6 @@ function garland_process_html(&$vars) {
if (module_exists('color')) {
_color_html_alter($vars);
}
$vars['styles'] .= "\n<!--[if lt IE 7]>\n" . garland_get_ie_styles() . "<![endif]-->\n";
}
/**
......@@ -136,17 +139,3 @@ function garland_preprocess_region(&$vars) {
function garland_menu_local_tasks() {
return menu_primary_local_tasks();
}
/**
* Generates IE CSS links for LTR and RTL languages.
*/
function garland_get_ie_styles() {
global $language;
$ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . file_create_url(path_to_theme() . '/fix-ie.css') . '" />' . "\n";
if ($language->direction == LANGUAGE_RTL) {
$ie_styles .= ' <style type="text/css" media="all">@import "' . file_create_url(path_to_theme() . '/fix-ie-rtl.css') . '";</style>' . "\n";
}
return $ie_styles;
}
......@@ -2,11 +2,16 @@
// $Id$
/**
* Override or insert variables into the page template.
* Override or insert variables into the html template.
*/
function seven_process_html(&$vars) {
$vars['styles'] .= "\n<!--[if lt IE 7]>\n" . '<link type="text/css" rel="stylesheet" media="all" href="' . file_create_url(path_to_theme() . '/ie6.css') . '" />' . "\n" . "<![endif]-->\n";
function seven_preprocess_html(&$vars) {
// Add conditional CSS for IE6.
drupal_add_css(path_to_theme() . '/ie6.css', array('weight' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
}
/**
* Override or insert variables into the page template.
*/
function seven_preprocess_page(&$vars) {
$vars['primary_local_tasks'] = menu_primary_local_tasks();
$vars['secondary_local_tasks'] = menu_secondary_local_tasks();
......
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