jenkins-bot has submitted this change and it was merged.
Change subject: Use OutputPage::addModuleStyles/Scripts to add modules
......................................................................
Use OutputPage::addModuleStyles/Scripts to add modules
Our problem was simply the usage of OutputPage::addModules instead
of addModuleStyles/Scripts. Using plain addModules caused the module
to be loaded via a mw.loader.load call instead of adding a
<script>/<link> tag to the page. The hook added in core
was unnecessary.
Bug: 68547
Bug: 68521
Change-Id: I683bb094a4fbf56d0139e6374fca7511d22ec633
---
M GlobalCssJs.hooks.php
M GlobalCssJs.php
2 files changed, 4 insertions(+), 4 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/GlobalCssJs.hooks.php b/GlobalCssJs.hooks.php
index 95acfd2..0cc467f 100644
--- a/GlobalCssJs.hooks.php
+++ b/GlobalCssJs.hooks.php
@@ -4,11 +4,11 @@
/**
* @param OutputPage $out
- * @param array $modules
* @return bool
*/
- static function onOutputPageScriptsForBottomQueue( OutputPage $out,
array &$modules ) {
- $modules = array_merge( $modules, array(
'ext.globalCssJs.user', 'ext.globalCssJs.site' ) );
+ static function onBeforePageDisplay( OutputPage $out ) {
+ $out->addModuleStyles( array( 'ext.globalCssJs.user',
'ext.globalCssJs.site' ) );
+ $out->addModuleScripts( array( 'ext.globalCssJs.user',
'ext.globalCssJs.site' ) );
return true;
}
diff --git a/GlobalCssJs.php b/GlobalCssJs.php
index f03faa1..bd712b2 100644
--- a/GlobalCssJs.php
+++ b/GlobalCssJs.php
@@ -64,7 +64,7 @@
}
}
-$wgHooks['OutputPageScriptsForBottomQueue'][] =
'GlobalCssJsHooks::onOutputPageScriptsForBottomQueue';
+$wgHooks['BeforePageDisplay'][] = 'GlobalCssJsHooks::onBeforePageDisplay';
$wgHooks['ResourceLoaderRegisterModules'][] =
'GlobalCssJsHooks::onResourceLoaderRegisterModules';
$wgHooks['EditPage::showEditForm:initial'][] =
'GlobalCssJsHooks::onEditPageshowEditForminitial';
$wgHooks['GetPreferences'][] = 'GlobalCssJsHooks::onGetPreferences';
--
To view, visit https://gerrit.wikimedia.org/r/150442
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I683bb094a4fbf56d0139e6374fca7511d22ec633
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/GlobalCssJs
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits