From fc672dc57b146deac7c79b1c36dd2da861cef2fd Mon Sep 17 00:00:00 2001 From: Pppery Date: Sat, 9 Nov 2024 22:31:06 -0500 Subject: [PATCH] Show if gadget is hidden Bug: T379101 Change-Id: Ic54a541ae332aeb7aca77248f7fa4709ab93a61a --- i18n/en.json | 3 ++- i18n/qqq.json | 3 ++- includes/Special/SpecialGadgets.php | 9 +++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 6e6e898e..80c07e82 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -61,5 +61,6 @@ "gadgets-validate-unknownpages": "Contains one or more pages without .js, .css or .json suffix. They would not be used.", "gadgets-validate-duplicate": "A second definition of gadget $1 was detected and shall be ignored", "gadgets-validate-nopage": "Page \"$1\" does not exist.", - "gadgets-supports-urlload": "This gadget supports loading via URL with ?withgadget query parameter." + "gadgets-supports-urlload": "This gadget supports loading via URL with ?withgadget query parameter.", + "gadgets-hidden": "This gadget is [https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:Gadgets#hidden hidden], meaning it will not show up on the preferences page." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 29a2bf11..4eb9604d 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -77,5 +77,6 @@ "gadgets-validate-unknownpages": "Warning message to indicate that a gadget contains pages without .js, .css or .json suffix, which are not recognised.", "gadgets-validate-duplicate": "Warning message to indicate that the second gadget definition with the same name would be ignored. Parameters:\n* $1 -gadget name", "gadgets-validate-nopage": "Warning message to indicate the script/style/json page does not exist. Parameters:\n* $1 - page name", - "gadgets-supports-urlload": "Used in [[Special:Gadgets]], if the gadget supports ?withgadget query parameter." + "gadgets-supports-urlload": "Used in [[Special:Gadgets]], if the gadget supports ?withgadget query parameter.", + "gadgets-hidden": "Used in [[Special:Gadgets]], if the gadget is hidden." } diff --git a/includes/Special/SpecialGadgets.php b/includes/Special/SpecialGadgets.php index b2bcb3bc..c6e3df64 100644 --- a/includes/Special/SpecialGadgets.php +++ b/includes/Special/SpecialGadgets.php @@ -376,7 +376,16 @@ class SpecialGadgets extends SpecialPage { ); $needLineBreakAfter = true; } + // Show if hidden + if ( $gadget->isHidden() ) { + if ( $needLineBreakAfter ) { + $output->addHTML( '
' ); + } + $output->addHTML( $this->msg( 'gadgets-hidden' )->parse() ); + $needLineBreakAfter = true; + } + // Show if supports URL load if ( $gadget->supportsUrlLoad() ) { if ( $needLineBreakAfter ) { $output->addHTML( '
' );