From: Timo Tijhof Date: Tue, 16 Aug 2016 21:12:55 +0000 (-0500) Subject: SkinTemplate: Move bottomScripts() back sightly X-Git-Tag: 1.31.0-rc.0~6037^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=2cfdf4956b953c9c87845c4e6bfd2484dc8e5617;p=lhc%2Fweb%2Fwiklou.git SkinTemplate: Move bottomScripts() back sightly Follows-up 80e5b160e, 95fc8a96db. In 80e5b160e, the module queue formatting was changed and was now fixed at the first call to headElement() or bottomScripts(), instead of being kept dynamic in between. Doing so fixed various bugs but also broke a few cases where things still add to the bottom queue after the headElement() is already created (such as sidebar). In 95fc8a96db, the bottomScripts() method was moved to the very bottom of prepareQuickTemplate(). This was imho too far and not needed because any line after 'headElement()' element is effectively the same since that will commit the queue. It also changed the order of hook execution, from: - SkinAfterBottomScripts, SkinTemplateOutputPageBeforeExec, SkinAfterContent to: - SkinTemplateOutputPageBeforeExec, SkinAfterContent, SkinAfterBottomScripts With the latter no longer being able to add things to the module queue since it now runs after headElement() commits the queue. Move it back up, to right above headElement(). This way the order is the same as before 95fc8a96db (first bottomScripts, then headElement). But still after all other properties, thus still keeping the regression from 80e5b160e fixed. Bug: T87871 Change-Id: I8f774880e60e31c0e996b20acdc5ce5e42a84b01 --- diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 749a6860c3..b4be461949 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -478,6 +478,9 @@ class SkinTemplate extends Skin { $tpl->set( 'sidebar', $this->buildSidebar() ); $tpl->set( 'nav_urls', $this->buildNavUrls() ); + // Do this last in case hooks above add bottom scripts + $tpl->set( 'bottomscripts', $this->bottomScripts() ); + // Set the head scripts near the end, in case the above actions resulted in added scripts $tpl->set( 'headelement', $out->headElement( $this ) ); @@ -508,9 +511,6 @@ class SkinTemplate extends Skin { // See Skin::afterContentHook() for further documentation. $tpl->set( 'dataAfterContent', $this->afterContentHook() ); - // Do this last in case hooks above add bottom scripts - $tpl->set( 'bottomscripts', $this->bottomScripts() ); - return $tpl; }