Minerva currently uses a hybrid of templates and MinervaTemplate. I am interested in collaborating with somebody who shares my interest to make it use the core SkinMustache class.
Vector will soon be using SkinMustache (see T251212) and it's important that the two most widely used skins (serving desktop and mobile traffic) reflect how we want to build skins going forward. This will help inform the template data provided by SkinMustache and a core skin API.
= Proposed roadmap
(Feel free to create subtasks!)
[x] A new **public** function MinervaTemplate::getTemplateData is refactored out of the MinervaTemplate::render function - it should take no arguments. The MinervaTemplate::render function should be merged with the execute function (see developer note 1 for how this should look)
[x] SkinMinerva class is updated so it `extends SkinMustache` and calls MinervaTemplate::getTemplateData. `MinervaTemplate::execute` should have an empty body at this point.
Now SkinMinerva is using SkinMustache slowly migrate the contents of MinervaTemplate piece by piece to the new SkinMinerva class. Whereever possible refer and use [[ https://github.com/wikimedia/mediawiki/blob/master/includes/skins/SkinMustache.php#L74 or mirror the names of the data | the core SkinMustache template variables ]] or use names/data structures that mirror the [[ https://github.com/wikimedia/Vector/blob/master/includes/SkinVector.php#L118 | template variables used in SkinVector ]]
[] Remove getFooterTemplateData https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/631867
[] Unused template variables are removed
[] Replace subtitle with data provided by SkinMinerva
[] Replace all message keys variables defined inside getTemplateData e.g. main-menu-tooltip with definitions inside SkinMinerva::$options['message']
...
[] When MinervaTemplate has been reduced to a getTemplateData function and private functions, move these functions to SkinMinerva and remove the MinervaTemplate class
[] Review all triple brace template variables e.g. {{{search}}} and replace with templates and data where possible
[] Make sure all template keys provided by Minerva have "minerva-" in their title so they can be distinguished from values coming from core.
# Developer notes
[1] Proposed revised MinervaTemplate execute method:
```
/**
* Start render the page in template
*/
public function execute() {
$templateParser = new TemplateParser( __DIR__ );
// begin rendering
echo $templateParser->processTemplate( 'skin', $this->getTemplateData() );
$this->printTrail();
?>
</body>
</html>
<?php
}
```
[2] Proposed revised transitional SkinMinerva class
```
/**
* Initialize Minerva Skin
*/
public function __construct( $options ) {
$options['templateDirectory'] = __DIR__;
$options['name'] = 'minerva';
parent::__construct( $options );
$this->skinOptions = MediaWikiServices::getInstance()->getService( 'Minerva.SkinOptions' );
}
public function getTemplateData() : array {
$tpl = $this->prepareQuickTemplate();
return parent::getTemplateData() + $tpl->getTemplateData();
}
```