Restore compact languages button user preference

The compact languages button user preference will be applied to
any compact language button provided by the skin, this allows users
to opt out of the feature as before.

This will be used immediately in Vector in
I436554d9d51470d277d59c2c71e08124735e12fd

Bug: T282149
Change-Id: I726c61d4c6895a28b999781752535e0ddc961744
This commit is contained in:
jdlrobson
2021-05-14 08:03:45 -07:00
committed by Jdlrobson
parent a463ea4c2b
commit 09a2b33bd6
2 changed files with 10 additions and 0 deletions

View File

@@ -112,6 +112,7 @@ class UniversalLanguageSelectorHooks {
$override = is_array( $excludedLinks ) && in_array( '*', $excludedLinks );
$config = [
'wgULSPosition' => $wgULSPosition,
'wgULSisCompactLinksEnabled' => self::isCompactLinksEnabled( $out->getUser() ),
];
// Load compact links if no mw-interlanguage-selector element is present in the page HTML.

View File

@@ -245,6 +245,15 @@
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) ),
configPosition = mw.config.get( 'wgULSPosition' );
if ( !mw.config.get( 'wgULSisCompactLinksEnabled' ) ) {
// The wgULSisCompactLinksEnabled flag when disabled will not render a language button to the page
// Skins can control where the button is placed, by adding an element with mw-interlanguage-selector to the page,
// the display of which is not impacted by this flag. To signal to these skins that the language button should be
// disabled, the class is removed.
$( '.mw-interlanguage-selector' ).removeClass( 'mw-interlanguage-selector' );
return;
}
if ( configPosition === 'interlanguage' ) {
// TODO: Refactor this block
// The interlanguage links section.