mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-27 09:42:48 +00:00
refactor: convert part of HTML to Mustache
This commit is contained in:
parent
bd5738afe8
commit
e85d4785b1
|
@ -19,6 +19,7 @@ use JsonException;
|
|||
use MediaWiki\MediaWikiServices;
|
||||
use Parser;
|
||||
use PPFrame;
|
||||
use TemplateParser;
|
||||
use Sanitizer;
|
||||
|
||||
class Tabber {
|
||||
|
@ -107,11 +108,13 @@ class Tabber {
|
|||
return sprintf( '[%s]', $tabpanels );
|
||||
}
|
||||
|
||||
return "<div id='tabber-$count' class='tabber tabber--init'>" .
|
||||
'<header class="tabber__header"><button class="tabber__header__prev" aria-hidden="true"></button>' .
|
||||
'<nav class="tabber__tabs" role="tablist">' . $tabs . '</nav>' .
|
||||
'<button class="tabber__header__next" aria-hidden="true"></button></header>' .
|
||||
'<section class="tabber__section">' . $tabpanels . '</section></div>';
|
||||
$templateParser = new TemplateParser( __DIR__ . '/templates' );
|
||||
$data = [
|
||||
'count' => $count,
|
||||
'html-tabs' => $tabs,
|
||||
'html-tabpanels' => $tabpanels
|
||||
];
|
||||
return $templateParser->processTemplate( 'Tabber', $data );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
13
includes/templates/Tabber.mustache
Normal file
13
includes/templates/Tabber.mustache
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{!
|
||||
int count Current Tabber count
|
||||
string html-tabs
|
||||
string html-tabpanels
|
||||
}}
|
||||
<div id="tabber-{{count}}" class='tabber tabber--init'>
|
||||
<header class="tabber__header">
|
||||
<button class="tabber__header__prev" aria-hidden="true"></button>
|
||||
<nav class="tabber__tabs" role="tablist">{{{html-tabs}}}</nav>
|
||||
<button class="tabber__header__next" aria-hidden="true"></button>
|
||||
</header>
|
||||
<section class="tabber__section">{{{html-tabpanels}}}</section>
|
||||
</div>
|
Loading…
Reference in a new issue