Skip to content

Commit

Permalink
Fix #91: Ensure mediawiki.skinning.content module is loadable
Browse files Browse the repository at this point in the history
In MW 1.33 the ResourceLoaderRegisterModules hook is called before
the standard MW module definitions are loaded from Resources.php.
It is therefore not possible to work with these module definitions
from inside the hook.

It is in particular not possible to register a module
0.mediawiki.skinning.content based on the module
mediawiki.skinning.content.

Instead of registering 0.mediawiki.skinning.content to enforce the
correct loading order for modules a module zzz.ext.bootstrap.styles
is registered.
  • Loading branch information
s7eph4n committed Jul 12, 2019
1 parent a200f49 commit 7e4259d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.md
Expand Up @@ -10,6 +10,7 @@ Changes:
Fixes:
* ([#87](https://github.com/cmln/chameleon/issues/87)) Show formedit button on the navbar
* ([#89](https://github.com/cmln/chameleon/issues/89)) Show default icon for unknown page tools on the navbar
* ([#91](https://github.com/cmln/chameleon/issues/91)) Ensure mediawiki.skinning.content module is loadable


### Chameleon 2.0
Expand Down
10 changes: 5 additions & 5 deletions src/Chameleon.php
Expand Up @@ -89,7 +89,7 @@ public static function init() {
// FIXME: Put this in a proper class, so it can be tested
$GLOBALS[ 'wgHooks' ][ 'ResourceLoaderRegisterModules' ][ ] = function( ResourceLoader $rl ) {

$rl->register( '0.mediawiki.skinning.content', $rl->getModule( 'mediawiki.skinning.content' ) );
$rl->register( 'zzz.ext.bootstrap.styles', $rl->getModule( 'ext.bootstrap.styles' ) );

};

Expand Down Expand Up @@ -117,8 +117,8 @@ public function getDefaultModules() {
unset( $modules[ 'styles' ][ 'core' ][ $modulePos ] ); // we have our own version of these styles
}

$modules[ 'styles' ][ 'content' ][] = '0.mediawiki.skinning.content';
$modules[ 'styles' ][ 'content' ][] = 'ext.bootstrap.styles';
$modules[ 'styles' ][ 'content' ][] = 'mediawiki.skinning.content';
$modules[ 'styles' ][ 'content' ][] = 'zzz.ext.bootstrap.styles';

}

Expand All @@ -140,9 +140,9 @@ public function setupSkinUserCss( OutputPage $out ) {
if ( $this->stylesHaveBeenProcessed === false ) {

$moduleStyles = [
'0.mediawiki.skinning.content',
'mediawiki.skinning.content',
'mediawiki.legacy.commonPrint',
'ext.bootstrap.styles'
'zzz.ext.bootstrap.styles'
];

if ( $out->isSyndicated() ) {
Expand Down

0 comments on commit 7e4259d

Please sign in to comment.