resourceloader: Introduce hooks in ResourceLoaderSiteModule
This will allow extensions/skins to alter the wiki pages that editors can use to control styles Bug: T237050 Change-Id: I329415b787136fcf9422a9deebfcd34f83b40f12
This commit is contained in:
parent
7b49e17eff
commit
5b044bb928
4 changed files with 16 additions and 3 deletions
|
|
@ -76,6 +76,8 @@ For notes on 1.34.x and older releases, see HISTORY.
|
|||
getRobotPolicy() returns the entire policy as a string in the form
|
||||
<index policy>,<follow policy> while getIndexPolicy() and getFollowPolicy()
|
||||
return their respective policies as a string.
|
||||
* The ResourceLoaderSiteModulePages and ResourceLoaderSiteStylesModulePages
|
||||
hooks were added to allow changing which wiki pages these modules contain.
|
||||
* …
|
||||
|
||||
=== External library changes in 1.35 ===
|
||||
|
|
|
|||
|
|
@ -3049,6 +3049,14 @@ $type: 'normal' or 'history' for old/diff views
|
|||
message must be in HTML format, not wikitext!
|
||||
&$link: overridable HTML link to be passed into the message as $1
|
||||
|
||||
'ResourceLoaderSiteModulePages': Modify list of pages for a given skin
|
||||
$skin: string of the current skin key
|
||||
&$pages: array of pages and their types.
|
||||
|
||||
'ResourceLoaderSiteStylesModulePages': Modify list of pages for a given skin
|
||||
$skin: string of the current skin key
|
||||
&$pages: array of pages and their types.
|
||||
|
||||
'SkinEditSectionLinks': Modify the section edit links
|
||||
$skin: Skin object rendering the UI
|
||||
$title: Title object for the title being linked to (may not be the same as
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ class ResourceLoaderSiteModule extends ResourceLoaderWikiModule {
|
|||
protected function getPages( ResourceLoaderContext $context ) {
|
||||
$pages = [];
|
||||
if ( $this->getConfig()->get( 'UseSiteJs' ) ) {
|
||||
$skin = $context->getSkin();
|
||||
$pages['MediaWiki:Common.js'] = [ 'type' => 'script' ];
|
||||
$pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.js'] = [ 'type' => 'script' ];
|
||||
$pages['MediaWiki:' . ucfirst( $skin ) . '.js'] = [ 'type' => 'script' ];
|
||||
Hooks::run( 'ResourceLoaderSiteModulePages', [ $skin, &$pages ] );
|
||||
}
|
||||
return $pages;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,11 @@ class ResourceLoaderSiteStylesModule extends ResourceLoaderWikiModule {
|
|||
protected function getPages( ResourceLoaderContext $context ) {
|
||||
$pages = [];
|
||||
if ( $this->getConfig()->get( 'UseSiteCss' ) ) {
|
||||
$skin = $context->getSkin();
|
||||
$pages['MediaWiki:Common.css'] = [ 'type' => 'style' ];
|
||||
$pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.css'] = [ 'type' => 'style' ];
|
||||
$pages['MediaWiki:' . ucfirst( $skin ) . '.css'] = [ 'type' => 'style' ];
|
||||
$pages['MediaWiki:Print.css'] = [ 'type' => 'style', 'media' => 'print' ];
|
||||
|
||||
Hooks::run( 'ResourceLoaderSiteStylesModulePages', [ $skin, &$pages ] );
|
||||
}
|
||||
return $pages;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue