jenkins-bot has submitted this change and it was merged.
Change subject: WPB improve docs,addCustomBanner drop return value
......................................................................
WPB improve docs,addCustomBanner drop return value
Improve the description of functions in WikidataPageBanner.hooks.php.
Remove the return value of addCustomBanner which is returning a static
value.
Change-Id: I8257914b86f07d4bb51ffba4d6ede60055aa3f57
---
M includes/WikidataPageBanner.hooks.php
1 file changed, 10 insertions(+), 5 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/WikidataPageBanner.hooks.php
b/includes/WikidataPageBanner.hooks.php
index 58052be..6465701 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -2,7 +2,8 @@
class WikidataPageBanner {
/**
* WikidataPageBanner::addBanner Generates banner from given options
and adds it and its styles
- * to Output Page
+ * to Output Page. If no options defined through {{PAGEBANNER}}, tries
to add a wikidata banner
+ * or a default one.
*
* @param $out OutputPage
* @param $skin Skin Object
@@ -71,6 +72,7 @@
/**
* WikidataPageBanner::onOutputPageParserOutput add banner parameters
from ParserOutput to
* Output page
+ *
* @param OutputPage $out
* @param ParserOutput $pOut
*/
@@ -89,19 +91,22 @@
if ( strpos( $options['toc'], 'class="toc"' )
!== false ) {
$options['toc'] = str_replace(
'class="toc"', '', $options['toc'] );
}
+ // disable default TOC
$out->enableTOC( false );
}
+ // set banner properties as an OutputPage property
$out->setProperty( 'wpb-banner-options', $options );
}
}
/**
* WikidataPageBanner::addCustomBanner
- * Parser function hooked to 'PAGEBANNER' magic word, to expand and
load banner.
+ * Parser function hooked to 'PAGEBANNER' magic word, to define a
custom banner and options to
+ * customize banner such as icons,horizontal TOC,etc. The method does
not return any content but
+ * sets the banner parameters in ParserOutput object for use at a later
stage to generate banner
*
* @param $parser Parser
* @param $bannername Name of custom banner
- * @return output
*/
public static function addCustomBanner( $parser, $bannername ) {
global $wgWPBNamespaces;
@@ -131,6 +136,7 @@
if ( isset( $argumentsFromParserFunction['tooltip'] ) )
{
$paramsForBannerTemplate['tooltip'] =
$argumentsFromParserFunction['tooltip'];
}
+ // set 'bottomtoc' parameter to allow TOC completely
below the banner
if ( isset( $argumentsFromParserFunction['bottomtoc'] )
&&
$argumentsFromParserFunction['bottomtoc'] === 'yes' ) {
$paramsForBannerTemplate['bottomtoc'] = true;
@@ -143,7 +149,6 @@
// Set 'wpb-banner-options' property for generating
banner later
$parser->getOutput()->setProperty(
'wpb-banner-options', $paramsForBannerTemplate );
}
- return array( '', 'noparse' => true, 'isHTML' => true );
}
/**
@@ -253,7 +258,7 @@
}
/**
- * Fetches banner from wikidata for the specified page
+ * WikidataPageBanner::getWikidataBanner Fetches banner from wikidata
for the specified page
*
* @param Title $title Title of the page
* @return String|null file name of the banner from wikidata
--
To view, visit https://gerrit.wikimedia.org/r/227254
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8257914b86f07d4bb51ffba4d6ede60055aa3f57
Gerrit-PatchSet: 4
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