mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-18 00:30:40 +00:00
Create HookRunner class and the hook handler interface
Bug: T315823 Change-Id: I09c45ed939e103e6edb3a76623687574dcf0206f
This commit is contained in:
parent
2bb554f1ea
commit
903034de23
|
@ -29,6 +29,7 @@ use MediaWiki\Hook\FetchChangesListHook;
|
||||||
use MediaWiki\Hook\OutputPageBodyAttributesHook;
|
use MediaWiki\Hook\OutputPageBodyAttributesHook;
|
||||||
use MediaWiki\Hook\UserLogoutCompleteHook;
|
use MediaWiki\Hook\UserLogoutCompleteHook;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
use MediaWiki\Minerva\Hooks\HookRunner;
|
||||||
use MediaWiki\Minerva\Skins\SkinMinerva;
|
use MediaWiki\Minerva\Skins\SkinMinerva;
|
||||||
use MediaWiki\Minerva\Skins\SkinUserPageHelper;
|
use MediaWiki\Minerva\Skins\SkinUserPageHelper;
|
||||||
use MediaWiki\ResourceLoader\Context;
|
use MediaWiki\ResourceLoader\Context;
|
||||||
|
@ -320,7 +321,7 @@ class Hooks implements
|
||||||
),
|
),
|
||||||
SkinOptions::TABS_ON_SPECIALS => true,
|
SkinOptions::TABS_ON_SPECIALS => true,
|
||||||
] );
|
] );
|
||||||
$services->getHookContainer()->run( 'SkinMinervaOptionsInit', [ $skin, $skinOptions ] );
|
( new HookRunner( $services->getHookContainer() ) )->onSkinMinervaOptionsInit( $skin, $skinOptions );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
includes/Hooks/HookRunner.php
Normal file
31
includes/Hooks/HookRunner.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MediaWiki\Minerva\Hooks;
|
||||||
|
|
||||||
|
use MediaWiki\HookContainer\HookContainer;
|
||||||
|
use MediaWiki\Minerva\SkinOptions;
|
||||||
|
use Skin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a hook runner class, see docs/Hooks.md in core.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
class HookRunner implements
|
||||||
|
SkinMinervaOptionsInitHook
|
||||||
|
{
|
||||||
|
private HookContainer $hookContainer;
|
||||||
|
|
||||||
|
public function __construct( HookContainer $hookContainer ) {
|
||||||
|
$this->hookContainer = $hookContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function onSkinMinervaOptionsInit( Skin $skin, SkinOptions $skinOptions ) {
|
||||||
|
return $this->hookContainer->run(
|
||||||
|
'SkinMinervaOptionsInit',
|
||||||
|
[ $skin, $skinOptions ]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
22
includes/Hooks/SkinMinervaOptionsInitHook.php
Normal file
22
includes/Hooks/SkinMinervaOptionsInitHook.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MediaWiki\Minerva\Hooks;
|
||||||
|
|
||||||
|
use MediaWiki\Minerva\SkinOptions;
|
||||||
|
use Skin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a hook handler interface, see docs/Hooks.md in core.
|
||||||
|
* Use the hook name "SkinMinervaOptionsInit" to register handlers implementing this interface.
|
||||||
|
*
|
||||||
|
* @stable to implement
|
||||||
|
* @ingroup Hooks
|
||||||
|
*/
|
||||||
|
interface SkinMinervaOptionsInitHook {
|
||||||
|
/**
|
||||||
|
* @param Skin $skin
|
||||||
|
* @param SkinOptions $skinOptions
|
||||||
|
* @return bool|void True or no return value to continue or false to abort
|
||||||
|
*/
|
||||||
|
public function onSkinMinervaOptionsInit( Skin $skin, SkinOptions $skinOptions );
|
||||||
|
}
|
Loading…
Reference in a new issue