The hidden attribute has been part of the RL2/Gadgets 2.0 branch from the start. A similar workaround (rights=hidden) has also merged for the current version of the Gadgets extension.
All of this logic has also been merged in the master branch last year, but is currently usable via the GadgetDefinitionNamespaceRepo. The MediaWikiGadgetsDefinitionRepo doesn't currently look for this attribute when parsing the definitions.
Let's add it there as well.
Below the original request from BugZilla about the same feature:
Author: beau
Description:
Patch adding a new gadget attribute: hidden
Before ResourceLoader was created Gadgets extension offered nice way to reuse common (library) code in gadgets - it is possible that two gadgets use a same js/css page. Such page is loaded only once.
New implementation based on ResourceLoader duplicates code for every gadget. So the same library will be downloaded and executed many times.
I would like to request a new attribute 'hidden' for gadgets, which should not be displayed in preferences. This attribute allows creating ResourceLoader modules which can be referenced by dependecies parameter.
Example use case:
- awesomeLibrary [ResourceLoader | hidden] | fileA.js | fileB.js | thisLibraryHasStyle.css
- awesomeGadget-1 [ResourceLoader | dependencies=ext.gadget.awesomeLibrary ] | awesomeGadget-1.js
- awesomeGadget-2 [ResourceLoader | dependencies=ext.gadget.awesomeLibrary ] | awesomeGadget-2.js
Attached:
See also: * T41025: Gadgets 2.0: "hidden" doesn't work