diff --git a/ResourceLoaderGeSHiLocalModule.php b/ResourceLoaderGeSHiLocalModule.php index ce62224b..8d6564a7 100644 --- a/ResourceLoaderGeSHiLocalModule.php +++ b/ResourceLoaderGeSHiLocalModule.php @@ -20,6 +20,21 @@ * Custom ResourceLoader module that loads a Geshi.css per-wiki. */ class ResourceLoaderGeSHiLocalModule extends ResourceLoaderWikiModule { + + /** @var string Position on the page to load this module at */ + protected $position = 'bottom'; + + public function __construct( $options ) { + foreach ( $options as $member => $option ) { + switch ( $member ) { + case 'position': + $this->isPositionDefined = true; + $this->{$member} = (string)$option; + break; + } + } + } + /** * @param $context ResourceLoaderContext * @return array @@ -34,4 +49,8 @@ class ResourceLoaderGeSHiLocalModule extends ResourceLoaderWikiModule { 'MediaWiki:Geshi.css' => array( 'type' => 'style' ), ); } + + public function getPosition() { + return $this->position; + } } diff --git a/ResourceLoaderGeSHiModule.php b/ResourceLoaderGeSHiModule.php index 5ce21aae..047ce6b5 100644 --- a/ResourceLoaderGeSHiModule.php +++ b/ResourceLoaderGeSHiModule.php @@ -19,16 +19,28 @@ class ResourceLoaderGeSHiModule extends ResourceLoaderModule { + /** @var string Position on the page to load this module at */ + protected $position = 'bottom'; + /** * @var string */ protected $lang; /** - * @param array $info Module definition. + * @param array $options Module definition. */ - function __construct( $info ) { - $this->lang = $info['lang']; + function __construct( $options ) { + foreach ( $options as $member => $option ) { + switch ( $member ) { + case 'position': + $this->isPositionDefined = true; + // Don't break, we want to set the property as well + case 'lang': + $this->{$member} = (string)$option; + break; + } + } } /** @@ -77,4 +89,8 @@ class ResourceLoaderGeSHiModule extends ResourceLoaderModule { ); return $summary; } + + public function getPosition() { + return $this->position; + } } diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php index c4f0d0c6..bedab08a 100644 --- a/SyntaxHighlight_GeSHi.class.php +++ b/SyntaxHighlight_GeSHi.class.php @@ -550,6 +550,7 @@ class SyntaxHighlight_GeSHi { foreach ( self::getSupportedLanguages() as $lang ) { $modules["ext.geshi.language.$lang" ] = array( + 'position' => 'top', 'class' => 'ResourceLoaderGeSHiModule', 'lang' => $lang, ); diff --git a/extension.json b/extension.json index 4e78e9d4..2787b1be 100644 --- a/extension.json +++ b/extension.json @@ -24,6 +24,7 @@ }, "ResourceModules": { "ext.geshi.local": { + "position": "top", "class": "ResourceLoaderGeSHiLocalModule" } },