From 48cdc5a33da4825f7679a87594adf1f4bfea3bf7 Mon Sep 17 00:00:00 2001 From: jsn Date: Wed, 12 Oct 2022 08:37:28 -0500 Subject: [PATCH] hooks: implement PreferencesGetLayout Use mobile layout in Special:Preferences Bug: T320586 Depends-On: I468481b66bf96880d1779cd11a46e18745e2c894 Change-Id: Ic6aa01e6e8806d1f2be8e07ca6c83decd62bc641 --- includes/Hooks.php | 15 +++++++++++++++ skin.json | 1 + 2 files changed, 16 insertions(+) diff --git a/includes/Hooks.php b/includes/Hooks.php index ad4130720..00c2d1d1f 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -96,6 +96,21 @@ class Hooks implements } } + /** + * PreferencesGetLayout hook handler. + * + * Use mobile layout in Special:Preferences + * @see https://phabricator.wikimedia.org/T311717 + * + * @param bool &$useMobileLayout + * @param Skin $skin + */ + public static function onPreferencesGetLayout( &$useMobileLayout, Skin $skin ) { + if ( $skin->getSkinName() === 'minerva' ) { + $useMobileLayout = true; + } + } + /** * Disable recent changes enhanced mode (table mode) * @see https://www.mediawiki.org/wiki/Manual:Hooks/FetchChangesList diff --git a/skin.json b/skin.json index eb8e8dece..eb1e08f48 100644 --- a/skin.json +++ b/skin.json @@ -150,6 +150,7 @@ "RequestContextCreateSkinMobile": [ "MediaWiki\\Minerva\\Hooks::onRequestContextCreateSkinMobile" ], + "PreferencesGetLayout": "main", "SpecialPageBeforeExecute": "main", "ResourceLoaderGetConfigVars": "main", "OutputPageBodyAttributes": "main"