Merge "Source footer data from SkinMustache"
This commit is contained in:
commit
150acb06f6
|
@ -133,7 +133,6 @@ class SkinVector extends SkinMustache {
|
|||
'html-newtalk' => $newTalksHtml ? '<div class="usermessage">' . $newTalksHtml . '</div>' : '',
|
||||
|
||||
'html-categories' => $skin->getCategories(),
|
||||
'data-footer' => $this->getFooterData(),
|
||||
|
||||
'is-search-in-header' => $isSearchInHeader,
|
||||
'input-location' => $this->getSearchBoxInputLocation( $isSearchInHeader ),
|
||||
|
@ -175,73 +174,6 @@ class SkinVector extends SkinMustache {
|
|||
: Constants::SEARCH_BOX_INPUT_LOCATION_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rows that make up the footer
|
||||
* @return array for use in Mustache template describing the footer elements.
|
||||
*/
|
||||
private function getFooterData() : array {
|
||||
$skin = $this;
|
||||
$footerRows = [];
|
||||
foreach ( $this->getFooterLinks() as $category => $links ) {
|
||||
$items = [];
|
||||
$rowId = "footer-$category";
|
||||
|
||||
foreach ( $links as $key => $link ) {
|
||||
// Link may be null. If so don't include it.
|
||||
if ( $link ) {
|
||||
$items[] = [
|
||||
'id' => "$rowId-$key",
|
||||
'html' => $link,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$footerRows[] = [
|
||||
'id' => $rowId,
|
||||
'className' => null,
|
||||
'array-items' => $items
|
||||
];
|
||||
}
|
||||
|
||||
// If footer icons are enabled append to the end of the rows
|
||||
$footerIcons = $this->getFooterIcons();
|
||||
|
||||
if ( count( $footerIcons ) > 0 ) {
|
||||
$items = [];
|
||||
foreach ( $footerIcons as $blockName => $blockIcons ) {
|
||||
$html = '';
|
||||
foreach ( $blockIcons as $icon ) {
|
||||
// Only output icons which have an image.
|
||||
// For historic reasons this mimics the `icononly` option
|
||||
// for BaseTemplate::getFooterIcons.
|
||||
if ( is_string( $icon ) || isset( $icon['src'] ) ) {
|
||||
$html .= $skin->makeFooterIcon( $icon );
|
||||
}
|
||||
}
|
||||
// For historic reasons this mimics the `icononly` option
|
||||
// for BaseTemplate::getFooterIcons. Empty rows should not be output.
|
||||
if ( $html ) {
|
||||
$items[] = [
|
||||
'id' => 'footer-' . htmlspecialchars( $blockName ) . 'ico',
|
||||
'html' => $html,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Empty rows should not be output.
|
||||
// This is how Vector has behaved historically but we can revisit.
|
||||
if ( count( $items ) > 0 ) {
|
||||
$footerRows[] = [
|
||||
'id' => 'footer-icons',
|
||||
'className' => 'noprint',
|
||||
'array-items' => $items,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [ 'array-footer-rows' => $footerRows ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines wheather the initial state of sidebar is visible on not
|
||||
*
|
||||
|
|
|
@ -10,17 +10,15 @@
|
|||
@prop footerItem[] array-items
|
||||
|
||||
string|null html-user-language-attributes a string of attribute HTML
|
||||
footerRow[] array-footer-rows iterable list of footer rows
|
||||
footerRow data-info the info row
|
||||
footerRow data-places the places row
|
||||
footerRow data-icons the icons row
|
||||
}}
|
||||
{{! `role` is unnecessary but kept to support selectors in any gadgets or user styles and
|
||||
to mitigate a VoiceOver bug. }}
|
||||
<footer id="footer" class="mw-footer" role="contentinfo" {{{html-user-language-attributes}}}>
|
||||
{{#array-footer-rows}}
|
||||
<ul id="{{id}}" {{#className}}class="{{.}}"{{/className}}>
|
||||
{{#array-items}}
|
||||
<li id="{{id}}">{{{html}}}</li>
|
||||
{{/array-items}}
|
||||
</ul>
|
||||
{{/array-footer-rows}}
|
||||
{{#data-info}}{{>Footer__row}}{{/data-info}}
|
||||
{{#data-places}}{{>Footer__row}}{{/data-places}}
|
||||
{{#data-icons}}{{>Footer__row}}{{/data-icons}}
|
||||
<div style="clear: both;"></div>
|
||||
</footer>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<ul id="{{id}}" {{#className}}class="{{.}}"{{/className}}>
|
||||
{{#array-items}}
|
||||
<li id="{{id}}">{{{html}}}</li>
|
||||
{{/array-items}}
|
||||
</ul>
|
|
@ -3,8 +3,8 @@
|
|||
import { htmlUserLanguageAttributes } from './utils';
|
||||
import footerTemplate from '!!raw-loader!../includes/templates/Footer.mustache';
|
||||
|
||||
const FOOTER_ROWS = [
|
||||
{
|
||||
const
|
||||
FOOTER_INFO = {
|
||||
id: 'footer-info',
|
||||
'array-items': [
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ additional terms may apply. See <a href="https://foundation.wikimedia.org/wiki/S
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
FOOTER_PLACES = {
|
||||
id: 'footer-places',
|
||||
'array-items': [
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ additional terms may apply. See <a href="https://foundation.wikimedia.org/wiki/S
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
FOOTER_ICONS = {
|
||||
id: 'footer-icons',
|
||||
'array-items': [
|
||||
{
|
||||
|
@ -68,12 +68,13 @@ additional terms may apply. See <a href="https://foundation.wikimedia.org/wiki/S
|
|||
html: `<a href="https://www.mediawiki.org/"><img src="https://wikipedia.org/static/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" srcset="https://wikipedia.org/static/images/poweredby_mediawiki_132x47.png 1.5x, https://wikipedia.org/static/images/poweredby_mediawiki_176x62.png 2x" width="88" height="31"/></a>`
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export { footerTemplate };
|
||||
|
||||
export const FOOTER_TEMPLATE_DATA = {
|
||||
'html-user-language-attributes': htmlUserLanguageAttributes,
|
||||
'array-footer-rows': FOOTER_ROWS
|
||||
'data-info': FOOTER_INFO,
|
||||
'data-places': FOOTER_PLACES,
|
||||
'data-icons': FOOTER_ICONS
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue