mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-27 23:50:30 +00:00
Merge "Minerva should use the SkinMustache class"
This commit is contained in:
commit
7bebd8a8d1
|
@ -38,6 +38,8 @@ class MinervaTemplate extends BaseTemplate {
|
|||
|
||||
/**
|
||||
* Start render the page in template
|
||||
* @deprecated please migrate code here to SkinMinerva::getTemplateData
|
||||
* @return array
|
||||
*/
|
||||
public function execute() {
|
||||
$title = $this->getSkin()->getTitle();
|
||||
|
@ -50,7 +52,7 @@ class MinervaTemplate extends BaseTemplate {
|
|||
|
||||
$this->isMainPageTalk = Title::newFromLinkTarget( $subjectPage )->isMainPage();
|
||||
Hooks::run( 'MinervaPreRender', [ $this ], '1.35' );
|
||||
$this->render( $this->data );
|
||||
return $this->getTemplateData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -223,10 +225,11 @@ class MinervaTemplate extends BaseTemplate {
|
|||
|
||||
/**
|
||||
* Render the entire page
|
||||
* @param array $data Data used to build the page
|
||||
* @todo replace with template engines
|
||||
* @deprecated please migrate code here to SkinMinerva::getTemplateData
|
||||
* @return array
|
||||
*/
|
||||
protected function render( $data ) {
|
||||
protected function getTemplateData() {
|
||||
$data = $this->data;
|
||||
$skinOptions = MediaWikiServices::getInstance()->getService( 'Minerva.SkinOptions' );
|
||||
$templateParser = new TemplateParser( __DIR__ );
|
||||
|
||||
|
@ -236,13 +239,12 @@ class MinervaTemplate extends BaseTemplate {
|
|||
$hasPageActions = $this->hasPageActions( $data['skin']->getContext() );
|
||||
|
||||
// prepare template data
|
||||
$templateData = [
|
||||
return [
|
||||
'banners' => $data['banners'],
|
||||
'wgScript' => $data['wgScript'],
|
||||
'isAnon' => $data['username'] === null,
|
||||
'search' => $data['search'],
|
||||
'placeholder' => wfMessage( 'mobile-frontend-placeholder' ),
|
||||
'headelement' => $data[ 'headelement' ],
|
||||
'main-menu-tooltip' => $this->getMsg( 'mobile-frontend-main-menu-button-tooltip' ),
|
||||
'siteheading' => $data['footer-site-heading-html'],
|
||||
'mainPageURL' => Title::newMainPage()->getLocalURL(),
|
||||
|
@ -279,13 +281,6 @@ class MinervaTemplate extends BaseTemplate {
|
|||
'items' => array_values( $data['content_navigation']['namespaces'] ),
|
||||
] : false,
|
||||
];
|
||||
// begin rendering
|
||||
echo $templateParser->processTemplate( 'skin', $templateData );
|
||||
$this->printTrail();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ use MediaWiki\Minerva\Skins\SkinUserPageHelper;
|
|||
* A skin that works on both desktop and mobile
|
||||
* @ingroup Skins
|
||||
*/
|
||||
class SkinMinerva extends SkinTemplate {
|
||||
class SkinMinerva extends SkinMustache {
|
||||
/** @const LEAD_SECTION_NUMBER integer which corresponds to the lead section
|
||||
* in editing mode
|
||||
*/
|
||||
|
@ -57,11 +57,22 @@ class SkinMinerva extends SkinTemplate {
|
|||
public function __construct() {
|
||||
parent::__construct( [
|
||||
'name' => 'minerva',
|
||||
'templateDirectory' => __DIR__,
|
||||
'responsive' => true
|
||||
] );
|
||||
$this->skinOptions = MediaWikiServices::getInstance()->getService( 'Minerva.SkinOptions' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTemplateData() {
|
||||
$data = parent::getTemplateData();
|
||||
$tpl = $this->prepareQuickTemplate();
|
||||
$tplData = $tpl->execute();
|
||||
return $data + $tplData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy load the permissions object. We don't want to initialize it as it requires many
|
||||
* dependencies, sometimes some of those dependencies cannot be fulfilled (like missing Title
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{{{headelement}}}
|
||||
<div id="mw-mf-viewport">
|
||||
<div id="mw-mf-page-center">
|
||||
<a class="mw-mf-page-center__mask" href="#"></a>
|
||||
|
|
Loading…
Reference in a new issue