Sumit has uploaded a new change for review.
https://gerrit.wikimedia.org/r/218691
Change subject: WikidataPageBanner custom banner on page-preview
......................................................................
WikidataPageBanner custom banner on page-preview
Modify loadModules() to add banner style after checking a valid namespace for
banner and not check for articlebanner property. This is being done because the
extension in any case tries to add a banner on allowed namespaces, and adding a
style assuming a banner, allows banners to be seen on page-preview.
Remove addition of 'loadImage' module as it no longer exists.
Bug: T100983
Change-Id: I3c69250a540d6ce1ad05f9e0bbe00c7db7069b2b
---
M includes/WikidataPageBanner.hooks.php
1 file changed, 10 insertions(+), 4 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataPageBanner
refs/changes/91/218691/1
diff --git a/includes/WikidataPageBanner.hooks.php
b/includes/WikidataPageBanner.hooks.php
index ac1c6bf..6ced653 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -59,10 +59,16 @@
* @return bool
*/
public static function loadModules( $out, $parserOutput ) {
- if ( $out->getProperty( 'articlebanner' ) != null ) {
- // if articlebanner property is set, we need to add
banner styles
- $out->addModuleStyles( 'ext.WikidataPageBanner' );
- $out->addModules( 'ext.WikidataPageBanner.loadImage' );
+ global $wgBannerNamespaces;
+ $pageTitle = $out->getPageTitle();
+ $title = Title::newFromText( $pageTitle );
+ if ( isset( $title ) ) {
+ $ns = $title->getNamespace();
+ if ( in_array( $ns, $wgBannerNamespaces ) ) {
+ // add banner style on allowed namespaces, so
that banners are visible even on
+ // preview
+ $out->addModuleStyles( 'ext.WikidataPageBanner'
);
+ }
}
}
--
To view, visit https://gerrit.wikimedia.org/r/218691
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c69250a540d6ce1ad05f9e0bbe00c7db7069b2b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataPageBanner
Gerrit-Branch: master
Gerrit-Owner: Sumit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits