mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-13 17:49:25 +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\SidebarBeforeOutputHook;
|
||||||
use MediaWiki\Hook\SkinBuildSidebarHook;
|
use MediaWiki\Hook\SkinBuildSidebarHook;
|
||||||
use MediaWiki\Hook\SkinEditSectionLinksHook;
|
use MediaWiki\Hook\SkinEditSectionLinksHook;
|
||||||
use MediaWiki\Hook\SkinTemplateNavigation__UniversalHook;
|
|
||||||
use MediaWiki\ResourceLoader as RL;
|
use MediaWiki\ResourceLoader as RL;
|
||||||
use MediaWiki\Skins\Citizen\GetConfigTrait;
|
use MediaWiki\Skins\Citizen\GetConfigTrait;
|
||||||
use MediaWiki\Skins\Hook\SkinPageReadyConfigHook;
|
use MediaWiki\Skins\Hook\SkinPageReadyConfigHook;
|
||||||
|
@ -49,8 +48,7 @@ class SkinHooks implements
|
||||||
SidebarBeforeOutputHook,
|
SidebarBeforeOutputHook,
|
||||||
SkinBuildSidebarHook,
|
SkinBuildSidebarHook,
|
||||||
SkinEditSectionLinksHook,
|
SkinEditSectionLinksHook,
|
||||||
SkinPageReadyConfigHook,
|
SkinPageReadyConfigHook
|
||||||
SkinTemplateNavigation__UniversalHook
|
|
||||||
{
|
{
|
||||||
use GetConfigTrait;
|
use GetConfigTrait;
|
||||||
|
|
||||||
|
@ -214,11 +212,12 @@ class SkinHooks implements
|
||||||
/**
|
/**
|
||||||
* Modify navigation links
|
* Modify navigation links
|
||||||
*
|
*
|
||||||
|
* TODO: Update to a proper hook when T287622 is resolved
|
||||||
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation::Universal
|
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation::Universal
|
||||||
* @param SkinTemplate $sktemplate
|
* @param SkinTemplate $sktemplate
|
||||||
* @param array &$links
|
* @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
|
// Be extra safe because it might be active on other skins with caching
|
||||||
if ( $sktemplate->getSkinName() !== 'citizen' ) {
|
if ( $sktemplate->getSkinName() !== 'citizen' ) {
|
||||||
return;
|
return;
|
||||||
|
@ -248,6 +247,7 @@ class SkinHooks implements
|
||||||
/**
|
/**
|
||||||
* Update actions menu items
|
* Update actions menu items
|
||||||
*
|
*
|
||||||
|
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||||
* @param array &$links
|
* @param array &$links
|
||||||
*/
|
*/
|
||||||
private static function updateActionsMenu( &$links ) {
|
private static function updateActionsMenu( &$links ) {
|
||||||
|
@ -269,6 +269,7 @@ class SkinHooks implements
|
||||||
/**
|
/**
|
||||||
* Update associated pages menu items
|
* Update associated pages menu items
|
||||||
*
|
*
|
||||||
|
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||||
* @param array &$links
|
* @param array &$links
|
||||||
*/
|
*/
|
||||||
private static function updateAssociatedPagesMenu( &$links ) {
|
private static function updateAssociatedPagesMenu( &$links ) {
|
||||||
|
@ -293,11 +294,8 @@ class SkinHooks implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update toolbox menu items
|
* 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
|
* @param array &$links
|
||||||
*/
|
*/
|
||||||
private static function updateToolboxMenu( &$links ) {
|
private static function updateToolboxMenu( &$links ) {
|
||||||
|
@ -332,6 +330,7 @@ class SkinHooks implements
|
||||||
/**
|
/**
|
||||||
* Update user menu
|
* Update user menu
|
||||||
*
|
*
|
||||||
|
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||||
* @param SkinTemplate $sktemplate
|
* @param SkinTemplate $sktemplate
|
||||||
* @param array &$links
|
* @param array &$links
|
||||||
*/
|
*/
|
||||||
|
@ -363,6 +362,7 @@ class SkinHooks implements
|
||||||
/**
|
/**
|
||||||
* Update user interface preferences menu
|
* Update user interface preferences menu
|
||||||
*
|
*
|
||||||
|
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||||
* @param SkinTemplate $sktemplate
|
* @param SkinTemplate $sktemplate
|
||||||
* @param array &$links
|
* @param array &$links
|
||||||
*/
|
*/
|
||||||
|
@ -373,6 +373,7 @@ class SkinHooks implements
|
||||||
/**
|
/**
|
||||||
* Update views menu items
|
* Update views menu items
|
||||||
*
|
*
|
||||||
|
* @internal used inside Hooks\SkinHooks::onSkinTemplateNavigation
|
||||||
* @param array &$links
|
* @param array &$links
|
||||||
*/
|
*/
|
||||||
private static function updateViewsMenu( &$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\Tagline;
|
||||||
use MediaWiki\Skins\Citizen\Partials\Theme;
|
use MediaWiki\Skins\Citizen\Partials\Theme;
|
||||||
use SkinMustache;
|
use SkinMustache;
|
||||||
|
use SkinTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skin subclass for Citizen
|
* Skin subclass for Citizen
|
||||||
|
@ -56,6 +57,14 @@ class SkinCitizen extends SkinMustache {
|
||||||
parent::__construct( $options );
|
parent::__construct( $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
protected function runOnSkinTemplateNavigationHooks( SkinTemplate $skin, &$content_navigation ) {
|
||||||
|
parent::runOnSkinTemplateNavigationHooks( $skin, $content_navigation );
|
||||||
|
Hooks\SkinHooks::onSkinTemplateNavigation( $skin, $content_navigation );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -87,8 +87,7 @@
|
||||||
"SidebarBeforeOutput": "SkinHooks",
|
"SidebarBeforeOutput": "SkinHooks",
|
||||||
"SkinBuildSidebar": "SkinHooks",
|
"SkinBuildSidebar": "SkinHooks",
|
||||||
"SkinEditSectionLinks": "SkinHooks",
|
"SkinEditSectionLinks": "SkinHooks",
|
||||||
"SkinPageReadyConfig": "SkinHooks",
|
"SkinPageReadyConfig": "SkinHooks"
|
||||||
"SkinTemplateNavigation::Universal": "SkinHooks"
|
|
||||||
},
|
},
|
||||||
"ResourceModules": {
|
"ResourceModules": {
|
||||||
"skins.citizen.styles": {
|
"skins.citizen.styles": {
|
||||||
|
|
Loading…
Reference in a new issue