mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-24 06:24:22 +00:00
refactor(core): ♻️ use MW footer data and add onto it
This commit is contained in:
parent
4c9aa17bb2
commit
ac12ff0444
|
@ -31,39 +31,18 @@ namespace MediaWiki\Skins\Citizen\Partials;
|
||||||
final class Footer extends Partial {
|
final class Footer extends Partial {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rows that make up the footer
|
* Decorate footer template data
|
||||||
|
*
|
||||||
|
* @param array $footerData original data-footer
|
||||||
* @return array for use in Mustache template describing the footer elements.
|
* @return array for use in Mustache template describing the footer elements.
|
||||||
*/
|
*/
|
||||||
public function getFooterData(): array {
|
public function decorateFooterData( $footerData ): array {
|
||||||
$skin = $this->skin;
|
// Add label to footer-info to use in ContentFooter
|
||||||
|
foreach ( $footerData['data-info']['array-items'] as &$item ) {
|
||||||
$data = [];
|
$msgKey = 'citizen-page-info-' . $item['name'];
|
||||||
$footerLinks = $skin->getFooterLinksPublic();
|
$item['label'] = $this->skin->msg( $msgKey )->text();
|
||||||
|
|
||||||
// Based on SkinMustache
|
|
||||||
// Backported because of 1.35 support
|
|
||||||
foreach ( $footerLinks as $category => $links ) {
|
|
||||||
$items = [];
|
|
||||||
$rowId = "footer-$category";
|
|
||||||
|
|
||||||
foreach ( $links as $key => $link ) {
|
|
||||||
if ( $link ) {
|
|
||||||
$items[] = [
|
|
||||||
'id' => "$rowId-$key",
|
|
||||||
'html' => $link,
|
|
||||||
// This is not great, need to reimplemented when we move to 1.39
|
|
||||||
'label' => $skin->msg( "citizen-page-info-$key" )
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['data-citizen-' . $category] = [
|
|
||||||
'id' => $rowId,
|
|
||||||
'className' => null,
|
|
||||||
'array-items' => $items
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $footerData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ class SkinCitizen extends SkinMustache {
|
||||||
'data-personal-menu' => $header->buildPersonalMenu(),
|
'data-personal-menu' => $header->buildPersonalMenu(),
|
||||||
'data-search-box' => $header->buildSearchProps(),
|
'data-search-box' => $header->buildSearchProps(),
|
||||||
],
|
],
|
||||||
'data-citizen-footer' => $footer->getFooterData(),
|
'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ),
|
||||||
// HTML strings
|
// HTML strings
|
||||||
'html-title-heading--formatted' => $pageTitle->buildTitle( $parentData, $title ),
|
'html-title-heading--formatted' => $pageTitle->buildTitle( $parentData, $title ),
|
||||||
'html-citizen-jumptotop' => $this->msg( 'citizen-jumptotop' )->text() . ' [home]',
|
'html-citizen-jumptotop' => $this->msg( 'citizen-jumptotop' )->text() . ' [home]',
|
||||||
|
@ -131,15 +131,6 @@ class SkinCitizen extends SkinMustache {
|
||||||
return parent::buildPersonalUrls();
|
return parent::buildPersonalUrls();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Change access to public, as it is used in partials
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
final public function getFooterLinksPublic() {
|
|
||||||
return parent::getFooterLinks();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change access to public, as it is used in partials
|
* Change access to public, as it is used in partials
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
}}
|
}}
|
||||||
<footer class="mw-body-footer">
|
<footer class="mw-body-footer">
|
||||||
{{{html-categories}}}
|
{{{html-categories}}}
|
||||||
{{#data-citizen-footer}}
|
{{#data-footer}}
|
||||||
{{#data-citizen-info}}{{>ContentFooter__item}}{{/data-citizen-info}}
|
{{#data-info}}{{>ContentFooter__item}}{{/data-info}}
|
||||||
{{/data-citizen-footer}}
|
{{/data-footer}}
|
||||||
</footer>
|
</footer>
|
Loading…
Reference in a new issue