Closed (fixed)
Project:
Zentropy
Version:
7.x-0.0-rc2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jun 2011 at 11:39 UTC
Updated:
10 Oct 2011 at 08:58 UTC
Drupal modules (ie. wysiwyg) asume that Javascripts with scope=footer are loaded after Javascripts with scope=header. Currently zentropy breaks this assumption.
By default header-JS goes into $script and footer-JS goes into $page_bottom. But zentropy's default html.tpl.php prints $script below $page_bottom.
function template_process_html(&$variables) {
// Render page_top and page_bottom into top level variables.
$variables['page_top'] = drupal_render($variables['page']['page_top']);
$variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
// Place the rendered HTML for the page body into a top level variable.
$variables['page'] = $variables['page']['#children'];
$variables['page_bottom'] .= drupal_get_js('footer');
$variables['head'] = drupal_get_html_head();
$variables['css'] = drupal_add_css();
$variables['styles'] = drupal_get_css();
$variables['scripts'] = drupal_get_js();
}
There is two possible ways to solve this:
Here is my implementation for 2.:
function zentropy_process_html(&$variables) {
// Render page_top and page_bottom into top level variables.
if (is_array($variables['page'])) {
$variables['page_top'] = drupal_render($variables['page']['page_top']);
$variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
// Place the rendered HTML for the page body into a top level variable.
$variables['page'] = $variables['page']['#children'];
}
$variables['head'] = drupal_get_html_head();
$variables['css'] = drupal_add_css();
$variables['styles'] = drupal_get_css();
$variables['scripts'] = drupal_get_js() . drupal_get_js('footer');
}
?>
Comments
Comment #1
torotil commentedOk, I forgot that template_process_html is executed before zentropy_process_html. Something like this would be better I guess:
Comment #2
migueltrindade commentedFixed in dev release.
Comment #3
torotil commentedNow the scripts are all put into . This definitely fixes the problem.