jenkins-bot has submitted this change and it was merged.
Change subject: Add 'top' flag to allow Gadgets to top-load
......................................................................
Add 'top' flag to allow Gadgets to top-load
Obviously this should be used sparingly, but it's needed for some
initialization stuff like registering plugins with VisualEditor.
Change-Id: Ifeed524a53601a47b3a945ca0a324bbbead0f1f5
---
M Gadgets_body.php
1 file changed, 25 insertions(+), 3 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Gadgets_body.php b/Gadgets_body.php
index c7e23bf..cfc5ab8 100644
--- a/Gadgets_body.php
+++ b/Gadgets_body.php
@@ -248,7 +248,7 @@
/**
* Increment this when changing class structure
*/
- const GADGET_CLASS_VERSION = 6;
+ const GADGET_CLASS_VERSION = 7;
private $version = self::GADGET_CLASS_VERSION,
$scripts = array(),
@@ -261,6 +261,7 @@
$requiredSkins = array(),
$targets = array( 'desktop' ),
$onByDefault = false,
+ $position = 'bottom',
$category;
/**
@@ -309,6 +310,9 @@
break;
case 'targets':
$gadget->targets = $params;
+ break;
+ case 'top':
+ $gadget->position = 'top';
break;
}
}
@@ -463,7 +467,7 @@
return null;
}
- return new GadgetResourceLoaderModule( $pages,
$this->dependencies, $this->targets );
+ return new GadgetResourceLoaderModule( $pages,
$this->dependencies, $this->targets, $this->position );
}
/**
@@ -499,6 +503,14 @@
*/
public function getRequiredSkins() {
return $this->requiredSkins;
+ }
+
+ /**
+ * Returns the position of this Gadget's ResourceLoader module
+ * @return String: 'bottom' or 'top'
+ */
+ public function getPosition() {
+ return $this->position;
}
/**
@@ -648,11 +660,13 @@
* )
* @param $dependencies Array: Names of resources this module depends on
* @param $targets Array: List of targets this module support
+ * @param $position String: 'bottom' or 'top'
*/
- public function __construct( $pages, $dependencies, $targets ) {
+ public function __construct( $pages, $dependencies, $targets, $position
) {
$this->pages = $pages;
$this->dependencies = $dependencies;
$this->targets = $targets;
+ $this->position = $position;
}
/**
@@ -671,4 +685,12 @@
public function getDependencies() {
return $this->dependencies;
}
+
+ /**
+ * Overrides ResourceLoaderModule::getPosition()
+ * @return String: 'bottom' or 'top'
+ */
+ public function getPosition() {
+ return $this->position;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/75506
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifeed524a53601a47b3a945ca0a324bbbead0f1f5
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits