Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75506


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, 24 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets 
refs/changes/06/75506/1

diff --git a/Gadgets_body.php b/Gadgets_body.php
index c7e23bf..28b53a1 100644
--- a/Gadgets_body.php
+++ b/Gadgets_body.php
@@ -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: newchange
Gerrit-Change-Id: Ifeed524a53601a47b3a945ca0a324bbbead0f1f5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to