In http://drupal.org/node/52508#comment-79259 (and http://drupal.org/node/22218 ) it states that the correct way for modules to include css is to use
drupal_set_html_head(theme('stylesheet_import', base_path() . drupal_get_path('module', 'mymodule') .'/mymodule.css'));
Doing this though stops the theme preview from occuring when editing the blocks (switching the theme at the top of the blocks page should provide a preview).
Using theme_add_style('misc/local/my_custom_style.css'); correctly previews the theme, but according to the post above is definitely NOT supposed to be used.
I've put this as critical partly for the bug, but also because I notice some modules (eg event) are using the theme_add_style version. Some extra clarity is needed for module authors I think (like me:-)
Comments
Comment #1
Zen commentedPlease read http://drupal.org/node/52508
Changing to a support request. If you still face any issues, please recategorise this issue.
Thanks :)
-K
Comment #2
profix898 commented@Zen: You should read issues more carefully ;) The link you posted is the same listed in the issue description! It tells module developers to use
drupal_set_html_head(theme('stylesheet_import', ...). But doing so makes it impossible to configure blocks per theme ...Comment #3
kiz_0987 commentedAs per profix898, moving back to bug report.
Comment #4
Zen commentedoops! Thanks for the cover profix :P
Setting it back to bug report.
-K
Comment #5
dries commentedThe difference between both functions is not clear based on looking at their name. Hence, the confusion. Using theme_add_style('misc/local/my_custom_style.css'); appears to make sense.
It would be a good idea to clean up the naming scheme (or to eliminate the need for both functions). Probably some post 4.7.0 task.
Comment #6
chx commentedComment #7
kiz_0987 commentedI can see the need for improved documentation, but there is still a bug here.
drupal_set_html_head(theme('stylesheet_import', base_path() . drupal_get_path('module', 'mymodule') .'/mymodule.css'));stops theme preview from working. Or is the documentation going to say "don't use drupal_set_html_head(theme('stylesheet_import', ..."?Comment #8
heine commentedThe problem of theme('stylesheet_import') in hook_menu or hook_init is the call to theme(), initializing the theme system. Later calls to init_theme silently return & the switch fails.
The theme_add_style('misc/local/my_custom_style.css'); or theme_stylesheet_import do not call the theme function so the switch can still happen.
Comment #9
thinkinkless commentedclosing (4.7)
Comment #10
avpaderno