currently, the <link>-tags for conditional stylesheets are hardcoded as a string

it would be much nicer if it used the same system core employs by making it a renderable array, rendered by theme_html_tag, so there's only 1 place for the fiddling to occur

(pretty sure u already know this, but just in case)
core does the following:
drupal_get_css makes an array, sets #type to styles and stuffs the array of stylesheets in #items
system_element_info defines #pre_render for 'styles' as 'drupal_pre_render_styles' and #pre_render for 'html_tag' as 'drupal_pre_render_conditional_comments'
drupal_pre_render_styles splits it up, using #type 'html_tag' and '#tag' either 'link' or 'style', and the #attributes
drupal_pre_render_conditional_comments then sets a #prefix and #suffix accordingly

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

seutje’s picture

#522006: Conditional Styles in .info files, since drupal_add_css has it would probably make the whole internal handling of conditionals by Zen completely obsolete, but I can't afford waiting on that right now

seutje’s picture

it just occurred to me that _conditional_styles_theme gets called when the theme registry is being rebuilt, so using drupal_render at that point doesn't rly work
I'ma check if I can store a serialized version of the conditional css and render it at runtime

seutje’s picture

Status: Active » Needs review
FileSize
5.61 KB

not entirely sure about this, might contain some unnecessary code and feels like a lot of code duplication, but it seems to work for my use-case

seutje’s picture

oops, wrong patch :x

seutje’s picture

also, perhaps we might want to slide in a drupal_alter in there

JohnAlbin’s picture

Title: Conditional stylesheet system should use renderable array » Conditional stylesheets should use drupal_add_css()
Status: Needs review » Needs work

Actually, now that drupal_add_css() has support for conditional stylesheets, the conditional stylesheets should be added via drupal_add_css() so that they are handled like all other stylesheets.

Thanks for looking at this, seutje, but I think we need to go a different way. See the recently updated http://drupal.org/project/conditional_styles

seutje’s picture

oh, cool... well, that works for me!
I just wanted to be able to get rid of those type attributes, rly :P

JohnAlbin’s picture

Status: Needs work » Fixed
seutje’s picture

you hero, you :')

JohnAlbin’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.