Ensure sticky header language button only shows when there are multiple languages and when ULS is enabled
Bug: T298705 Bug: T297579 Change-Id: Iae5db6fd0ec6ae66bb16e8579f14d3e799bf3cbd
This commit is contained in:
parent
42fec59f54
commit
3dda2dda5b
|
@ -229,15 +229,13 @@ class SkinVector extends SkinMustache {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If in modern Vector and no languages possible, OR the languages in header button
|
* Show the ULS button if it's modern Vector, languages in header is enabled,
|
||||||
* is enabled but language array is empty, then we shouldn't show the language list.
|
* and the language array isn't empty. Hide it otherwise.
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function shouldHideLanguages() {
|
private function shouldHideLanguages() {
|
||||||
return !$this->isLegacy() &&
|
// NOTE: T276950 - This should be revisited when an empty state for the language button is chosen.
|
||||||
!$this->canHaveLanguages() ||
|
return $this->isLegacy() || !$this->isLanguagesInContent() || empty( $this->getLanguagesCached() );
|
||||||
// NOTE: T276950 - This should be revisited when an empty state for the language button is chosen.
|
|
||||||
( $this->isLanguagesInContent() && empty( $this->getLanguagesCached() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -484,8 +482,12 @@ class SkinVector extends SkinMustache {
|
||||||
$btns[] = self::EDIT_PROTECTED_ICON;
|
$btns[] = self::EDIT_PROTECTED_ICON;
|
||||||
$btns[] = self::EDIT_VE_ICON;
|
$btns[] = self::EDIT_VE_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show sticky ULS if the ULS extension is enabled and the ULS in header is not hidden
|
||||||
|
$showStickyULS = ExtensionRegistry::getInstance()->isLoaded( 'UniversalLanguageSelector' )
|
||||||
|
&& !$this->shouldHideLanguages();
|
||||||
return [
|
return [
|
||||||
'data-primary-action' => $this->isLanguagesInContent() ?
|
'data-primary-action' => $showStickyULS ?
|
||||||
$this->getULSButtonData() : null,
|
$this->getULSButtonData() : null,
|
||||||
'data-button-start' => [
|
'data-button-start' => [
|
||||||
'label' => $this->msg( 'search' ),
|
'label' => $this->msg( 'search' ),
|
||||||
|
|
Loading…
Reference in a new issue