[development] Overriding CSS files in themes
Steve Ringwood
nevets at mailbag.com
Wed Nov 1 01:41:16 UTC 2006
Actually while what you say about calling
theme('add_style', drupal_get_path('module', 'mymodule').'/mymodule.css');
instead of
theme_add_style(drupal_get_path('module', 'mymodule')).'/mymodule.css');
makes sense, it has the un-intended side effect of initializing the theme
subsystem
and making it hard/impossible to override the theme being used. This
is in part due to the css/js being included in the menu hook which is also
often used as a place to overrride themes.
I would argue the answer is not to use a theme function (i.e.
theme_add_style)
since the direct call means it can not be override any how. It seems that
a more general solution should be provided that takes the files to add
(mymodule.css)
and a prefereed path ( drupal_get_path('module', 'mymodule')) which is used
if the file
(mymodule.css) does not exist in the "current" themes directory.
Steve Ringwood
More information about the development
mailing list