Separate language portal from other portals in sidebar

This commit is contained in:
alistair3149 2020-08-09 15:37:23 -04:00
parent 22832841da
commit 193c027eb4
2 changed files with 8 additions and 5 deletions

View file

@ -115,7 +115,7 @@ class CitizenTemplate extends BaseTemplate {
/** /**
* Render the navigation drawer * Render the navigation drawer
* Based on Vector (be3843e) * Based on Vector
* @return array * @return array
* @throws MWException * @throws MWException
* @throws Exception * @throws Exception
@ -124,6 +124,7 @@ class CitizenTemplate extends BaseTemplate {
$skin = $this->getSkin(); $skin = $this->getSkin();
$portals = $skin->buildSidebar(); $portals = $skin->buildSidebar();
$props = []; $props = [];
$languages = null;
// Render portals // Render portals
foreach ( $portals as $name => $content ) { foreach ( $portals as $name => $content ) {
@ -138,17 +139,17 @@ class CitizenTemplate extends BaseTemplate {
case 'SEARCH': case 'SEARCH':
break; break;
case 'TOOLBOX': case 'TOOLBOX':
$portal = $this->getMenuData( 'tb', $this->getToolbox() ); $portal = $this->getMenuData( 'tb', $content );
$props[] = $portal; $props[] = $portal;
break; break;
case 'LANGUAGES': case 'LANGUAGES':
$languages = $skin->getLanguages(); $languages = $skin->getLanguages();
$portal = $this->getMenuData( 'lang', $languages ); $portal = $this->getMenuData( 'lang', $content );
// The language portal will be added provided either // The language portal will be added provided either
// languages exist or there is a value in html-after-portal // languages exist or there is a value in html-after-portal
// for example to show the add language wikidata link (T252800) // for example to show the add language wikidata link (T252800)
if ( $portal['html-after-portal'] || count( $languages ) ) { if ( count( $content ) || $portal['html-after-portal'] ) {
$props[] = $portal; $languages = $portal;
} }
break; break;
default: default:
@ -202,6 +203,7 @@ class CitizenTemplate extends BaseTemplate {
'data-logo' => $this->buildLogo(), 'data-logo' => $this->buildLogo(),
'data-portals-first' => $firstPortal, 'data-portals-first' => $firstPortal,
'array-portals-rest' => array_slice( $props, 1 ), 'array-portals-rest' => array_slice( $props, 1 ),
'data-portals-languages' => $languages,
'data-personal-menu' => $personalToolsPortal, 'data-personal-menu' => $personalToolsPortal,
]; ];
} }

View file

@ -27,6 +27,7 @@
<section id="mw-drawer-menu-main"> <section id="mw-drawer-menu-main">
{{#data-portals-first}}{{>Menu}}{{/data-portals-first}} {{#data-portals-first}}{{>Menu}}{{/data-portals-first}}
{{#array-portals-rest}}{{>Menu}}{{/array-portals-rest}} {{#array-portals-rest}}{{>Menu}}{{/array-portals-rest}}
{{#data-portals-languages}}{{>Menu}}{{/data-portals-languages}}
</section> </section>
<section id="mw-drawer-menu-user" class="mw-user-links"> <section id="mw-drawer-menu-user" class="mw-user-links">
{{#data-personal-menu}}{{>Menu}}{{/data-personal-menu}} {{#data-personal-menu}}{{>Menu}}{{/data-personal-menu}}