Allow access to display and input settings in new vector

Light refactor of existing code into reusable method to support
this.

Use Extension attributes to allow skins to provide ULS
additional configuration.

Bug: T274396
Change-Id: I7dcd49f05fae83fbc0c15768bee8ca93eab17bcc
This commit is contained in:
jdlrobson authored and jenkins-bot committed 2021-02-22 11:02:10 +00:00
1 parent 5ec30a6f63
commit 96656c5f41
2 files changed
+41 -11

No files matched your search

+6 -3
View File
@@ -348,8 +348,9 @@ class UniversalLanguageSelectorHooks {
/**
* Hook: ResourceLoaderGetConfigVars
* @param array &$vars
* @param string $skin
*/
public static function addConfig( array &$vars ) {
public static function addConfig( array &$vars, $skin ) {
global $wgULSGeoService,
$wgULSIMEEnabled, $wgULSWebfontsEnabled,
$wgULSNoWebfontsSelectors,
@@ -360,6 +361,8 @@ class UniversalLanguageSelectorHooks {
$wgExtensionAssetsPath,
$wgInterwikiSortingSortPrepend;
$extRegistry = ExtensionRegistry::getInstance();
$skinConfig = $extRegistry->getAttribute( 'UniversalLanguageSelectorSkinConfig' )[ $skin ] ?? [];
// Place constant stuff here (not depending on request context)
if ( is_string( $wgULSGeoService ) ) {
@@ -369,11 +372,11 @@ class UniversalLanguageSelectorHooks {
$vars['wgULSIMEEnabled'] = $wgULSIMEEnabled;
$vars['wgULSWebfontsEnabled'] = $wgULSWebfontsEnabled;
$vars['wgULSAnonCanChangeLanguage'] = $wgULSAnonCanChangeLanguage;
$vars['wgULSEventLogging'] = $wgULSEventLogging
&& ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' );
$vars['wgULSEventLogging'] = $wgULSEventLogging && $extRegistry->isLoaded( 'EventLogging' );
$vars['wgULSImeSelectors'] = $wgULSImeSelectors;
$vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors;
$vars['wgULSNoWebfontsSelectors'] = $wgULSNoWebfontsSelectors;
$vars['wgULSDisplaySettingsInInterlanguage'] = $skinConfig['ULSDisplaySettingsInInterlanguage'] ?? false;
if ( is_string( $wgULSFontRepositoryBasePath ) ) {
$vars['wgULSFontRepositoryBasePath'] = $wgULSFontRepositoryBasePath;