In moving
modules from 5.x to 6.x it is commonly suggested to move our “drupal_add_css”
(and _js) into hook_init. Ceratinly I did this in nearly all my
modules because it was the common suggestion. However, now that I’m making a
big change in one and having problems with the CSS, it dawned on me that this suggestion
adds the CSS files to *every*
page, not just the ones we were targeting. It finally dawned on me that I have
hook_help that only fires on the pages I need to CSS on, so I moved the “drupal_add_css”
into hook_help, which to me makes a lot more sense because now my CSS is only
applied to those pages for which it is intended. What do others think of this? Are there pitfalls I may not
have covered?
Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. - Martin L.
King, Jr.