From 5c375bb71d6dc2faca1dcbcf734d8923c74a98ab Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Tue, 15 Nov 2022 22:39:10 -0500 Subject: [PATCH] =?UTF-8?q?refactor(core):=20=E2=99=BB=EF=B8=8F=20use=20th?= =?UTF-8?q?e=20same=20code=20pattern=20for=20SkinEditSectionLinks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/Hooks/SkinHooks.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/includes/Hooks/SkinHooks.php b/includes/Hooks/SkinHooks.php index 4b77a53a..b9e504c3 100644 --- a/includes/Hooks/SkinHooks.php +++ b/includes/Hooks/SkinHooks.php @@ -116,19 +116,22 @@ class SkinHooks implements * @param Language $lang */ public function onSkinEditSectionLinks( $skin, $title, $section, $sectionTitle, &$result, $lang ) { - /* - * FIXME: For some reason if you modify the VE button, it duplicates one automatically - * Bug: T323186 - * - * if ( $result['veeditsection'] ) { - * $result['veeditsection']['attribs']['class'] = 'mw-ui-icon-wikimedia-edit'; - * } - */ + // Be extra safe because it might be active on other skins with caching + if ( $skin->getSkinName() === 'citizen' && $result ) { + /* + * FIXME: For some reason if you modify the VE button, it duplicates one automatically + * Bug: T323186 + * + * if ( isset( $result['veeditsection'] ) ) { + * $result['veeditsection']['attribs']['class'] = 'mw-ui-icon-wikimedia-edit'; + * } + */ - // Add icon to edit section link - // If VE button is present, use wikiText icon - if ( $result['editsection'] ) { - $result['editsection']['attribs']['class'] = $result['veeditsection'] ? 'mw-ui-icon-wikimedia-wikiText' : 'mw-ui-icon-wikimedia-edit'; + // Add icon to edit section link + // If VE button is present, use wikiText icon + if ( isset( $result['editsection'] ) ) { + $result['editsection']['attribs']['class'] = $result['veeditsection'] ? 'mw-ui-icon-wikimedia-wikiText' : 'mw-ui-icon-wikimedia-edit'; + } } }