mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 07:43:47 +00:00
LanguageDropdown: Check if the page is in talk namespaces instead
$wgContentNamespaces is default to only contain the main namespace, we should check whether the page is a talk page instead. Also use the term "subject page" to align with existing functions of Title and NamespaceInfo. Bug: T316559 Bug: T326788 Change-Id: I873283195d5c503818b2056c87c25ecc77d2915a
This commit is contained in:
parent
888170264f
commit
a874eb1096
|
@ -53,12 +53,12 @@ class VectorComponentLanguageDropdown implements VectorComponent {
|
||||||
*/
|
*/
|
||||||
public function getTemplateData(): array {
|
public function getTemplateData(): array {
|
||||||
$title = $this->title;
|
$title = $this->title;
|
||||||
$isContentPage = $title && $title->exists() && $title->isContentPage();
|
$isSubjectPage = $title && $title->exists() && !$title->isTalkPage();
|
||||||
// if page doesn't exist or if it's not a content page, we should
|
// If page doesn't exist or if it's in a talk namespace, we should
|
||||||
// display a less prominent "language" button, without a label, and
|
// display a less prominent "language" button, without a label, and
|
||||||
// quiet instead of progressive. For this reason some default values
|
// quiet instead of progressive. For this reason some default values
|
||||||
// should be updated for this case. (T316559)
|
// should be updated for this case. (T316559)
|
||||||
if ( !$isContentPage ) {
|
if ( !$isSubjectPage ) {
|
||||||
$icon = '<span class="mw-ui-icon mw-ui-icon-wikimedia-language"></span>';
|
$icon = '<span class="mw-ui-icon mw-ui-icon-wikimedia-language"></span>';
|
||||||
$label = '';
|
$label = '';
|
||||||
$headingClass = 'mw-ui-button mw-ui-quiet mw-portlet-lang-heading-empty';
|
$headingClass = 'mw-ui-button mw-ui-quiet mw-portlet-lang-heading-empty';
|
||||||
|
@ -80,7 +80,7 @@ class VectorComponentLanguageDropdown implements VectorComponent {
|
||||||
// Override header icon (currently no way to do this using constructor)
|
// Override header icon (currently no way to do this using constructor)
|
||||||
$dropdownData['html-vector-heading-icon'] = $icon;
|
$dropdownData['html-vector-heading-icon'] = $icon;
|
||||||
$dropdownData['aria-label'] = $this->ariaLabel;
|
$dropdownData['aria-label'] = $this->ariaLabel;
|
||||||
$dropdownData['is-language-selector-empty'] = !$isContentPage;
|
$dropdownData['is-language-selector-empty'] = !$isSubjectPage;
|
||||||
|
|
||||||
return $dropdownData + $this->menuContentsData;
|
return $dropdownData + $this->menuContentsData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue