Show if gadget is hidden

Bug: T379101
Change-Id: Ic54a541ae332aeb7aca77248f7fa4709ab93a61a
This commit is contained in:
Pppery 2024-11-09 22:31:06 -05:00
parent 5f2bf9c3ef
commit fc672dc57b
3 changed files with 13 additions and 2 deletions

View file

@ -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 <code>?withgadget</code> query parameter."
"gadgets-supports-urlload": "This gadget supports loading via URL with <code>?withgadget</code> 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."
}

View file

@ -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."
}

View file

@ -376,7 +376,16 @@ class SpecialGadgets extends SpecialPage {
);
$needLineBreakAfter = true;
}
// Show if hidden
if ( $gadget->isHidden() ) {
if ( $needLineBreakAfter ) {
$output->addHTML( '<br />' );
}
$output->addHTML( $this->msg( 'gadgets-hidden' )->parse() );
$needLineBreakAfter = true;
}
// Show if supports URL load
if ( $gadget->supportsUrlLoad() ) {
if ( $needLineBreakAfter ) {
$output->addHTML( '<br />' );