[development] An alternative to common thinking in 5->6 migration

Nancy Wichmann nan_wich at bellsouth.net
Mon Mar 9 16:55:14 UTC 2009

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20090309/8b5fc8ac/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: multipart/alternative
Size: 0 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20090309/8b5fc8ac/attachment.bin 
-------------- next part --------------

No virus found in this outgoing message.
Checked by AVG - http://www.avg.com 
Version: 8.0.176 / Virus Database: 270.11.9/1990 - Release Date: 3/8/2009 5:17 PM

More information about the development mailing list