Fix lang portlet header display.

Timeless is showing the language portlet correctly when are languages or
when something is added to the portlet, but it's also showing the header
even if there are no languages and nothing extra was defined.

The root cause is that when we check $this->afterLangPortlet !== '', the
property is actually null at that stage, it is only defined when we call
$this->getPortlet( 'lang' ...) in the next line.

Bug: T256355
Change-Id: Ie3e0acccede7e2f477c6182e288def8d7a35070e
isekai
Ammar Abdulhamid 5 years ago
parent cc5a10db21
commit e5e188fbc6

@ -954,7 +954,6 @@ class TimelessTemplate extends BaseTemplate {
$html = ''; $html = '';
$variants = ''; $variants = '';
$otherprojects = ''; $otherprojects = '';
$languages = '';
$show = false; $show = false;
$variantsOnly = false; $variantsOnly = false;
@ -966,20 +965,18 @@ class TimelessTemplate extends BaseTemplate {
$show = true; $show = true;
$variantsOnly = true; $variantsOnly = true;
} }
if ( $this->sidebar['LANGUAGES'] !== false ||
// Force rendering of this section if the 'lang' portlet has $languages = $this->getPortlet( 'lang', $this->languages, 'otherlanguages' );
// been modified by hook even if there are no language items.
//$this->getAfterPortlet( 'lang' ) !== '' // Force rendering of this section if there are languages or when the 'lang'
$this->afterLangPortlet !== '' // portlet has been modified by hook even if there are no language items.
) { if ( count( $this->languages ) || $this->afterLangPortlet !== '' ) {
$languages = $this->getPortlet(
'lang',
$this->languages ?: [],
'otherlanguages'
);
$show = true; $show = true;
$variantsOnly = false; $variantsOnly = false;
} else {
$languages = '';
} }
// if using wikibase for 'in other projects' // if using wikibase for 'in other projects'
if ( isset( $this->otherProjects ) ) { if ( isset( $this->otherProjects ) ) {
$otherprojects = $this->getPortlet( $otherprojects = $this->getPortlet(

Loading…
Cancel
Save