mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-12 00:59:46 +00:00
fix(core): 🐛 use runOnSkinTemplateNavigationHooks instead
This should somewhat ensure Citizen gets to run its hook after all the extensions. Hopefully it will resolve various issues regarding hook load orders. Closes: #812
This commit is contained in:
parent
e50320c863
commit
ff3acf3b71
|
@ -31,7 +31,6 @@ use MediaWiki\Hook\BeforePageDisplayHook;
|
|||
use MediaWiki\Hook\SidebarBeforeOutputHook;
|
||||
use MediaWiki\Hook\SkinBuildSidebarHook;
|
||||
use MediaWiki\Hook\SkinEditSectionLinksHook;
|
||||
use MediaWiki\Hook\SkinTemplateNavigation__UniversalHook;
|
||||
use MediaWiki\ResourceLoader as RL;
|
||||
use MediaWiki\Skins\Citizen\GetConfigTrait;
|
||||
use MediaWiki\Skins\Hook\SkinPageReadyConfigHook;
|
||||
|
@ -49,8 +48,7 @@ class SkinHooks implements
|
|||
SidebarBeforeOutputHook,
|
||||
SkinBuildSidebarHook,
|
||||
SkinEditSectionLinksHook,
|
||||
SkinPageReadyConfigHook,
|
||||
SkinTemplateNavigation__UniversalHook
|
||||
SkinPageReadyConfigHook
|
||||
{
|
||||
use GetConfigTrait;
|
||||
|
||||
|
@ -214,11 +212,12 @@ class SkinHooks implements
|
|||
/**
|
||||
* Modify navigation links
|
||||
*
|
||||
* TODO: Update to a proper hook when T287622 is resolved
|
||||
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation::Universal
|
||||
* @param SkinTemplate $sktemplate
|
||||
* @param array &$links
|
||||
*/
|
||||
public function onSkinTemplateNavigation__Universal( $sktemplate, &$links ): void {
|
||||
public static function onSkinTemplateNavigation( $sktemplate, &$links ): void {
|
||||
// Be extra safe because it might be active on other skins with caching
|
||||
if ( $sktemplate->getSkinName() !== 'citizen' ) {
|
||||
return;
|
||||
|
@ -248,6 +247,7 @@ class SkinHooks implements
|
|||
/**
|
||||
* Update actions menu items
|
||||
*
|
||||
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||
* @param array &$links
|
||||
*/
|
||||
private static function updateActionsMenu( &$links ) {
|
||||
|
@ -269,6 +269,7 @@ class SkinHooks implements
|
|||
/**
|
||||
* Update associated pages menu items
|
||||
*
|
||||
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||
* @param array &$links
|
||||
*/
|
||||
private static function updateAssociatedPagesMenu( &$links ) {
|
||||
|
@ -293,11 +294,8 @@ class SkinHooks implements
|
|||
|
||||
/**
|
||||
* Update toolbox menu items
|
||||
* This is not guaranteed to run after extensions hook
|
||||
*
|
||||
* WORKAROUND: Load the skin after all extensions
|
||||
* FIXME: Revisit when T287622 is resolved
|
||||
*
|
||||
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||
* @param array &$links
|
||||
*/
|
||||
private static function updateToolboxMenu( &$links ) {
|
||||
|
@ -332,6 +330,7 @@ class SkinHooks implements
|
|||
/**
|
||||
* Update user menu
|
||||
*
|
||||
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||
* @param SkinTemplate $sktemplate
|
||||
* @param array &$links
|
||||
*/
|
||||
|
@ -363,6 +362,7 @@ class SkinHooks implements
|
|||
/**
|
||||
* Update user interface preferences menu
|
||||
*
|
||||
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||
* @param SkinTemplate $sktemplate
|
||||
* @param array &$links
|
||||
*/
|
||||
|
@ -373,6 +373,7 @@ class SkinHooks implements
|
|||
/**
|
||||
* Update views menu items
|
||||
*
|
||||
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||
* @param array &$links
|
||||
*/
|
||||
private static function updateViewsMenu( &$links ) {
|
||||
|
|
|
@ -33,6 +33,7 @@ use MediaWiki\Skins\Citizen\Partials\PageTools;
|
|||
use MediaWiki\Skins\Citizen\Partials\Tagline;
|
||||
use MediaWiki\Skins\Citizen\Partials\Theme;
|
||||
use SkinMustache;
|
||||
use SkinTemplate;
|
||||
|
||||
/**
|
||||
* Skin subclass for Citizen
|
||||
|
@ -56,6 +57,14 @@ class SkinCitizen extends SkinMustache {
|
|||
parent::__construct( $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function runOnSkinTemplateNavigationHooks( SkinTemplate $skin, &$content_navigation ) {
|
||||
parent::runOnSkinTemplateNavigationHooks( $skin, $content_navigation );
|
||||
Hooks\SkinHooks::onSkinTemplateNavigation( $skin, $content_navigation );
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
@ -87,8 +87,7 @@
|
|||
"SidebarBeforeOutput": "SkinHooks",
|
||||
"SkinBuildSidebar": "SkinHooks",
|
||||
"SkinEditSectionLinks": "SkinHooks",
|
||||
"SkinPageReadyConfig": "SkinHooks",
|
||||
"SkinTemplateNavigation::Universal": "SkinHooks"
|
||||
"SkinPageReadyConfig": "SkinHooks"
|
||||
},
|
||||
"ResourceModules": {
|
||||
"skins.citizen.styles": {
|
||||
|
|
Loading…
Reference in a new issue