Commit 8660655a authored by Steven Wittens's avatar Steven Wittens
Browse files

- #27981: Add media parameter to theme_add_style

parent 3feef48d
...@@ -349,9 +349,12 @@ function theme_get_setting($setting_name, $refresh = FALSE) { ...@@ -349,9 +349,12 @@ function theme_get_setting($setting_name, $refresh = FALSE) {
* Add a theme stylesheet to be included later. This is handled separately from * Add a theme stylesheet to be included later. This is handled separately from
* drupal_set_html_head() to enforce the correct CSS cascading order. * drupal_set_html_head() to enforce the correct CSS cascading order.
*/ */
function theme_add_style($style = '') { function theme_add_style($path = '', $media = 'all') {
static $styles = array(); static $styles = array();
if ($style) { if ($path) {
$style = new stdClass();
$style->path = $path;
$style->media = $media;
$styles[] = $style; $styles[] = $style;
} }
return $styles; return $styles;
...@@ -363,7 +366,7 @@ function theme_add_style($style = '') { ...@@ -363,7 +366,7 @@ function theme_add_style($style = '') {
function theme_get_styles() { function theme_get_styles() {
$output = ''; $output = '';
foreach (theme_add_style() as $style) { foreach (theme_add_style() as $style) {
$output .= theme('stylesheet_import', $style); $output .= theme('stylesheet_import', $style->path, $style->media);
} }
return $output; return $output;
} }
...@@ -833,8 +836,8 @@ function theme_mark($type = MARK_NEW) { ...@@ -833,8 +836,8 @@ function theme_mark($type = MARK_NEW) {
/** /**
* Import a stylesheet using @import. * Import a stylesheet using @import.
* *
* @param $stylesheet * @param $path
* The filename to point the link at. * The path to the stylesheet.
* *
* @param $media * @param $media
* The media type to specify for the stylesheet * The media type to specify for the stylesheet
...@@ -842,8 +845,8 @@ function theme_mark($type = MARK_NEW) { ...@@ -842,8 +845,8 @@ function theme_mark($type = MARK_NEW) {
* @return * @return
* A string containing the HTML for the stylesheet import. * A string containing the HTML for the stylesheet import.
*/ */
function theme_stylesheet_import($stylesheet, $media = 'all') { function theme_stylesheet_import($path, $media = 'all') {
return '<style type="text/css" media="'. $media .'">@import "'. $stylesheet .'";</style>'; return '<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
} }
/** /**
......
Supports Markdown
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