mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 01:20:07 +00:00
Favor SkinTemplateNavigation::Universal
This hook is run on every page. The SkinTemplateNavigation hook counter intutively is run only on pages which can exist. I think it's clearer if we only use SkinTemplateNavigation::Universal hook and keep the logic for when it runs inside our own code. Bug: T255319 Change-Id: I0835074a6cadf6e9bdcc45299de37dd9328bf9b2
This commit is contained in:
parent
249ef2ecee
commit
e7df44a66d
|
@ -119,9 +119,11 @@ class Hooks {
|
|||
* @param array &$content_navigation
|
||||
*/
|
||||
public static function onSkinTemplateNavigation( $sk, &$content_navigation ) {
|
||||
$title = $sk->getRelevantTitle();
|
||||
if (
|
||||
$sk->getConfig()->get( 'VectorUseIconWatch' ) &&
|
||||
$sk->getSkinName() === 'vector' &&
|
||||
$sk->getConfig()->get( 'VectorUseIconWatch' )
|
||||
$title && $title->canExist()
|
||||
) {
|
||||
$key = null;
|
||||
if ( isset( $content_navigation['actions']['watch'] ) ) {
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"SkinPageReadyConfig": "Vector\\Hooks::onSkinPageReadyConfig",
|
||||
"GetPreferences": "Vector\\Hooks::onGetPreferences",
|
||||
"PreferencesFormPreSave": "Vector\\Hooks::onPreferencesFormPreSave",
|
||||
"SkinTemplateNavigation": "Vector\\Hooks::onSkinTemplateNavigation",
|
||||
"SkinTemplateNavigation::Universal": "Vector\\Hooks::onSkinTemplateNavigation",
|
||||
"LocalUserCreated": "Vector\\Hooks::onLocalUserCreated",
|
||||
"OutputPageBodyAttributes": "Vector\\Hooks::onOutputPageBodyAttributes",
|
||||
"MakeGlobalVariablesScript": "Vector\\Hooks::onMakeGlobalVariablesScript"
|
||||
|
|
|
@ -289,6 +289,7 @@ class VectorHooksTest extends \MediaWikiTestCase {
|
|||
'wgVectorUseIconWatch' => true
|
||||
] );
|
||||
$skin = new SkinVector( [ 'name' => 'vector' ] );
|
||||
$skin->getContext()->setTitle( Title::newFromText( 'Foo' ) );
|
||||
$contentNavWatch = [
|
||||
'actions' => [
|
||||
'watch' => [ 'class' => 'watch' ],
|
||||
|
|
Loading…
Reference in a new issue