From 2c0571b89421e92e32a2f9b53a4ea24823bd2ef1 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 3 Aug 2006 07:06:36 +0000 Subject: - Patch #73961 by m3avrck, timcn, et al: simplify adding CSS in Drupal. --- includes/theme.inc | 55 ++++++------------------------------------------------ 1 file changed, 6 insertions(+), 49 deletions(-) (limited to 'includes/theme.inc') diff --git a/includes/theme.inc b/includes/theme.inc index 47388c839..3201ffbd7 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -53,19 +53,19 @@ function init_theme() { // If we're using a style, load its appropriate theme, // which is stored in the style's description field. - // Also load the stylesheet using theme_add_style(). + // Also add the stylesheet using drupal_add_css(). // Otherwise, load the theme. if (strpos($themes[$theme]->filename, '.css')) { // File is a style; loads its CSS. // Set theme to its template/theme - theme_add_style($themes[$theme]->filename); + drupal_add_css($themes[$theme]->filename, 'theme'); $theme = basename(dirname($themes[$theme]->description)); } else { // File is a template/theme // Load its CSS, if it exists if (file_exists($stylesheet = dirname($themes[$theme]->filename) .'/style.css')) { - theme_add_style($stylesheet); + drupal_add_css($stylesheet, 'theme'); } } @@ -324,33 +324,6 @@ function theme_get_setting($setting_name, $refresh = FALSE) { return isset($settings[$setting_name]) ? $settings[$setting_name] : NULL; } -/** - * Add a theme stylesheet to be included later. This is handled separately from - * drupal_set_html_head() to enforce the correct CSS cascading order. - */ -function theme_add_style($path = '', $media = 'all') { - static $styles = array(); - - if ($path && !isset($styles["$media:$path"])) { - $style = new stdClass(); - $style->path = base_path() . $path; - $style->media = $media; - $styles["$media:$path"] = $style; - } - return $styles; -} - -/** - * Return the HTML for a theme's stylesheets. - */ -function theme_get_styles() { - $output = ''; - foreach (theme_add_style() as $style) { - $output .= theme('stylesheet_import', $style->path, $style->media); - } - return $output; -} - /** * @defgroup themeable Themeable functions * @{ @@ -392,7 +365,7 @@ function theme_page($content) { $output .= ''; $output .= ' '. (drupal_get_title() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'drupal')) .''; $output .= drupal_get_html_head(); - $output .= theme_get_styles(); + $output .= drupal_get_css(); $output .= ' '; $output .= ' '; @@ -433,7 +406,7 @@ function theme_maintenance_page($content, $messages = TRUE, $partial = FALSE) { $output .= ''; $output .= ' '. strip_tags(drupal_get_title()) .''; $output .= drupal_get_html_head(); - $output .= theme_get_styles(); + $output .= drupal_get_css(); $output .= ''; $output .= ''; $output .= '

' . drupal_get_title() . '

'; @@ -462,7 +435,7 @@ function theme_install_page($content) { $output .= ''; $output .= ' '. strip_tags(drupal_get_title()) .''; $output .= drupal_get_html_head(); - $output .= theme_get_styles(); + $output .= drupal_get_css(); $output .= ''; $output .= ''; $output .= '

' . drupal_get_title() . '

'; @@ -855,22 +828,6 @@ function theme_mark($type = MARK_NEW) { } } -/** - * Import a stylesheet using @import. - * - * @param $path - * The path to the stylesheet. - * - * @param $media - * The media type to specify for the stylesheet - * - * @return - * A string containing the HTML for the stylesheet import. - */ -function theme_stylesheet_import($path, $media = 'all') { - return ''; -} - /** * Return a themed list of items. * -- cgit v1.2.3