mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-14 11:04:43 +00:00
Add global 'withgadget' query parameter for ad-hoc loading of gadgets
When viewing pages, the 'withgadget=' query parameter can be used in the URL to load a gadget that isn't enabled by the user's preferences. The gadget is only loaded if all other conditions are still satisfied (supported skin, supported targets, required user rights). Bug: T29766 Change-Id: I5b30d4e0010561685eef661a515e2892045bb776
This commit is contained in:
parent
32677ff590
commit
14af941e88
|
@ -172,6 +172,7 @@ class GadgetHooks {
|
|||
$lb = new LinkBatch();
|
||||
$lb->setCaller( __METHOD__ );
|
||||
$enabledLegacyGadgets = [];
|
||||
$req = $out->getRequest();
|
||||
|
||||
/**
|
||||
* @var $gadget Gadget
|
||||
|
@ -192,7 +193,7 @@ class GadgetHooks {
|
|||
// @todo: Emit warning for invalid peer?
|
||||
}
|
||||
}
|
||||
if ( $gadget->isEnabled( $user )
|
||||
if ( ( $gadget->isEnabled( $user ) || $req->getRawVal( 'withgadget' ) === $id )
|
||||
&& $gadget->isAllowed( $user )
|
||||
&& $gadget->isSkinSupported( $out->getSkin() )
|
||||
&& ( in_array( $out->getTarget() ?? 'desktop', $gadget->getTargets() ) )
|
||||
|
|
Loading…
Reference in a new issue