Sumit has uploaded a new change for review. https://gerrit.wikimedia.org/r/213576
Change subject: WikidataPageBanner: Add template for banner markup ...................................................................... WikidataPageBanner: Add template for banner markup The pagebanner rendered by echoing raw html, is now rendered using mustache template supported by core. Bug: T98152 Change-Id: Ib6736a75a34c5fc2d5648e3c7d7dd91b95092b90 --- M includes/WikidataPageBanner.hooks.php A templates/banner.mustache 2 files changed, 16 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataPageBanner refs/changes/76/213576/1 diff --git a/includes/WikidataPageBanner.hooks.php b/includes/WikidataPageBanner.hooks.php index 3b67b7e..522cc0e 100644 --- a/includes/WikidataPageBanner.hooks.php +++ b/includes/WikidataPageBanner.hooks.php @@ -121,22 +121,14 @@ * TODO:Move this banner html code to a template. */ public static function getBannerHtml( $bannerurl, $title ) { - $banner = Html::openElement( 'div', array( 'class' => 'noprint' ) ) . - Html::openElement( 'div', array( 'class' => 'ext-wpb-pagebanner', - 'style' => "background-image:url($bannerurl);" - ) - ) . - Html::openElement( 'div', array( 'class' => 'topbanner' ) ) . - Html::element( 'div', - array( 'class' => 'name' ), - $title - ) . - Html::element( 'div', - array( 'class' => 'iconbox' ) - ) . - Html::closeElement( 'div' ) . - Html::closeElement( 'div' ) . - Html::closeElement( 'div' ); + $templateParser = new TemplateParser( __DIR__ . '/../templates' ); + $banner = $templateParser->processTemplate( + 'banner', + array( + 'banner' => $bannerurl, + 'title' => $title + ) + ); return $banner; } diff --git a/templates/banner.mustache b/templates/banner.mustache new file mode 100644 index 0000000..cec3226 --- /dev/null +++ b/templates/banner.mustache @@ -0,0 +1,8 @@ +<div class="noprint"> + <div class="ext-wpb-pagebanner" style="background-image:url({{banner}})"> + <div class="topbanner"> + <div class="name">{{title}}</div> + <div class="iconbox"></div> + </div> + </div> +</div> -- To view, visit https://gerrit.wikimedia.org/r/213576 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib6736a75a34c5fc2d5648e3c7d7dd91b95092b90 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikidataPageBanner Gerrit-Branch: master Gerrit-Owner: Sumit <asthana.sumi...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits