Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
Bartik theme
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jul 2010 at 03:01 UTC
Updated:
25 Jul 2010 at 22:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
bleen commentedComment #2
sunThis should not happen.
Also, when looking at the existing functions in the file, appending to the bottom does not really make sense to me.
Either before bartik_process_maintenance_page(), or right at the beginning before bartik_preprocess_html(). Trying to wrap my head around the current order, I guess the author intended the former.
43 critical left. Go review some!
Comment #3
bleen commentedWhy not just add the CSS in the existing maintenance_process function...
Comment #4
sunprocess is too late for adding CSS or JS. That must always be done in preprocess.
Comment #5
bleen commentedHmm ... ok. @sun - can you explain when to use hook_preprocess functions vs. hook_process functions. I've been asking in IRC all week and no one has had a good answer.
In any case... lets try this.
Comment #6
sunThanks, looks better.
Process functions have been introduced to account for the fact that multiple preprocess functions may add further CSS and JS to a page or do some other trickery. Problem space being that the implementing module or system functionality needs or wants to consume and (re-)compile all added or altered things prior to passing them of to the template. Such as $scripts or $styles variables in html.tpl.php.
http://api.drupal.org/api/search/7/template_process_ is the complete list of process functions. Looking at http://api.drupal.org/api/function/template_process_html/7, you can see how this default template process function collects and prepares a list of variables for the template. This means that drupal_add_js() and drupal_add_css() can still be used in *_preprocess_html() implementations. While it is true that we could have used THEME_process_page() here (since it is not THEME_process_html), the general rule of thumb is that preprocess is for adding + preparing stuff; only use process if you need to rely on and process stuff added via preprocess.
Perhaps we need to improve the documentation on this. Not sure where that is currently located though. (d.o handbooks, perhaps?)
Comment #7
dries commentedCommitted to CVS HEAD. Thanks.