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
Comment | File | Size | Author |
---|---|---|---|
#4 | 923382-zen-conditional-css-drupal-render-2.patch | 5.61 KB | seutje |
#3 | 923382-zen-conditional-css-drupal-render.patch | 5.61 KB | seutje |
Comments
Comment #1
seutje CreditAttribution: seutje commented#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
Comment #2
seutje CreditAttribution: seutje commentedit 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
Comment #3
seutje CreditAttribution: seutje commentednot 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
Comment #4
seutje CreditAttribution: seutje commentedoops, wrong patch :x
Comment #5
seutje CreditAttribution: seutje commentedalso, perhaps we might want to slide in a drupal_alter in there
Comment #6
JohnAlbinActually, 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
Comment #7
seutje CreditAttribution: seutje commentedoh, cool... well, that works for me!
I just wanted to be able to get rid of those type attributes, rly :P
Comment #8
JohnAlbinFixed. http://drupal.org/cvs?commit=489900
Comment #9
seutje CreditAttribution: seutje commentedyou hero, you :')
Comment #10
JohnAlbinForgot something. http://drupal.org/cvs?commit=491254