diff --git a/includes/Partials/Footer.php b/includes/Partials/Footer.php index 2fddb6de..88b4d244 100644 --- a/includes/Partials/Footer.php +++ b/includes/Partials/Footer.php @@ -31,39 +31,18 @@ namespace MediaWiki\Skins\Citizen\Partials; 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. */ - public function getFooterData(): array { - $skin = $this->skin; - - $data = []; - $footerLinks = $skin->getFooterLinksPublic(); - - // 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 - ]; + public function decorateFooterData( $footerData ): array { + // Add label to footer-info to use in ContentFooter + foreach ( $footerData['data-info']['array-items'] as &$item ) { + $msgKey = 'citizen-page-info-' . $item['name']; + $item['label'] = $this->skin->msg( $msgKey )->text(); } - return $data; + return $footerData; } } diff --git a/includes/SkinCitizen.php b/includes/SkinCitizen.php index 20d7679d..cefb67fd 100644 --- a/includes/SkinCitizen.php +++ b/includes/SkinCitizen.php @@ -99,7 +99,7 @@ class SkinCitizen extends SkinMustache { 'data-personal-menu' => $header->buildPersonalMenu(), 'data-search-box' => $header->buildSearchProps(), ], - 'data-citizen-footer' => $footer->getFooterData(), + 'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ), // HTML strings 'html-title-heading--formatted' => $pageTitle->buildTitle( $parentData, $title ), 'html-citizen-jumptotop' => $this->msg( 'citizen-jumptotop' )->text() . ' [home]', @@ -131,15 +131,6 @@ class SkinCitizen extends SkinMustache { 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 * diff --git a/templates/ContentFooter.mustache b/templates/ContentFooter.mustache index 1f69a149..e92a817c 100644 --- a/templates/ContentFooter.mustache +++ b/templates/ContentFooter.mustache @@ -3,7 +3,7 @@ }} \ No newline at end of file