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

Change subject: WikidataPageBanner add a separate flag for toc
......................................................................


WikidataPageBanner add a separate flag for toc

This will prevent setting the actual toc with true, which results in rendering
of 1 in place of actual toc.

Bug: T115719
Change-Id: Iac3f17a0223e3a9d06d5a026ffc20d02eddfef3e
---
M includes/WikidataPageBanner.functions.php
M includes/WikidataPageBanner.hooks.php
M tests/phpunit/BannerOptionsTest.php
3 files changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/includes/WikidataPageBanner.functions.php 
b/includes/WikidataPageBanner.functions.php
index b6cb2f4..8865e59 100644
--- a/includes/WikidataPageBanner.functions.php
+++ b/includes/WikidataPageBanner.functions.php
@@ -22,7 +22,7 @@
         */
        public static function addToc( &$paramsForBannerTemplate, $options ) {
                if ( isset( $options['toc'] ) && $options['toc'] === 'yes' ) {
-                       $paramsForBannerTemplate['toc'] = true;
+                       $paramsForBannerTemplate['enable-toc'] = true;
                }
        }
 
diff --git a/includes/WikidataPageBanner.hooks.php 
b/includes/WikidataPageBanner.hooks.php
index bed606a..f8cbb25 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -150,7 +150,7 @@
                        $options = $pOut->getProperty( 'wpb-banner-options' );
 
                        // if toc parameter set and toc enabled, remove 
original classes and add banner class
-                       if ( isset( $options['toc'] ) && $pOut->getTOCEnabled() 
) {
+                       if ( isset( $options['enable-toc'] ) && 
$pOut->getTOCEnabled() ) {
                                $options['toc'] = $pOut->getTOCHTML();
                                // replace id and class of toc with blank
                                // FIXME! This code is hacky, until core has 
better handling of toc contents
diff --git a/tests/phpunit/BannerOptionsTest.php 
b/tests/phpunit/BannerOptionsTest.php
index 6a0a6de..6d7cc31 100644
--- a/tests/phpunit/BannerOptionsTest.php
+++ b/tests/phpunit/BannerOptionsTest.php
@@ -140,7 +140,7 @@
                WikidataPageBanner::addCustomBanner( $parser, 'Banner1',
                        'pgname=Banner2', 'toc=yes', 'test=testparam', 'test2' 
);
                $bannerparams = $pOut->getProperty( 'wpb-banner-options' );
-               $this->assertEquals( $bannerparams['toc'], true,
+               $this->assertEquals( $bannerparams['enable-toc'], true,
                        'toc must default to yes' );
                $this->assertEquals( array(
                        'Following arguments used in PAGEBANNER are invalid or 
unknown: test'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac3f17a0223e3a9d06d5a026ffc20d02eddfef3e
Gerrit-PatchSet: 2
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