jenkins-bot has submitted this change and it was merged.

Change subject: WikidataPageBanner switch for default banner
......................................................................


WikidataPageBanner switch for default banner

Adds a switch to enable default banners on pages.Even if $wgWPBImage is blank,
extension will still add a WikidataBanner. This might lead to duplication where
a banner has already been added by some other template and is not needed.

Bug: T108788
Change-Id: I5acefab6b4826f2069b4538e695533e373928201
---
M extension.json
M includes/WikidataPageBanner.hooks.php
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index cb7d6d3..65425cf 100644
--- a/extension.json
+++ b/extension.json
@@ -69,6 +69,7 @@
                ]
        },
        "config": {
+               "WPBEnableDefaultBanner": "false",
                "WPBImage": "",
                "WPBNamespaces": [
                        0
diff --git a/includes/WikidataPageBanner.hooks.php 
b/includes/WikidataPageBanner.hooks.php
index ca892a4..144db80 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -19,7 +19,7 @@
         * @return  bool
         */
        public static function addBanner( OutputPage $out ) {
-               global $wgWPBImage, $wgWPBNamespaces;
+               global $wgWPBImage, $wgWPBNamespaces, $wgWPBEnableDefaultBanner;
                $title = $out->getTitle();
                // if banner-options are set, add banner anyway
                if ( $out->getProperty( 'wpb-banner-options' ) !== null ) {
@@ -49,7 +49,7 @@
                        }
                }
                // if the page uses no 'PAGEBANNER' invocation and if article 
page, insert default banner
-               elseif ( $title->isKnown() && $out->isArticle() ) {
+               elseif ( $title->isKnown() && $out->isArticle() && 
$wgWPBEnableDefaultBanner ) {
                        $ns = $title->getNamespace();
                        // banner only on specified namespaces, and not Main 
Page of wiki
                        if ( in_array( $ns, $wgWPBNamespaces )

-- 
To view, visit https://gerrit.wikimedia.org/r/230978
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5acefab6b4826f2069b4538e695533e373928201
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataPageBanner
Gerrit-Branch: master
Gerrit-Owner: Sumit <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to