diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 92755ae8e..84d3b6c2b 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -316,10 +316,6 @@ class SkinVector extends SkinMustache { $title = $out->getTitle(); $parentData = parent::getTemplateData(); - if ( $this->shouldHideLanguages() ) { - $parentData['data-portlets']['data-languages'] = null; - } - // Naming conventions for Mustache parameters. // // Value type (first segment): @@ -497,6 +493,13 @@ class SkinVector extends SkinMustache { // ext.uls.interface attaches click handler to this selector. ' mw-interlanguage-selector ', ]; + + // Adds class to hide language button + // Temporary solution to T287206, can be removed when ULS dialog includes interwiki links + if ( $this->shouldHideLanguages() ) { + $languageButtonData['class'] = ' mw-portlet-empty'; + } + return array_merge( $portletData, $languageButtonData ); } diff --git a/resources/skins.vector.js/languageButton.js b/resources/skins.vector.js/languageButton.js index 76d40f719..e9f78593a 100644 --- a/resources/skins.vector.js/languageButton.js +++ b/resources/skins.vector.js/languageButton.js @@ -1,3 +1,20 @@ +/** + * Copies interwiki links to sidebar + * + * Temporary solution to T287206, can be removed when the new ULS built in Vue.js + * has been released and contains this + */ +function addInterwikiLinkToSidebar() { + // eslint-disable-next-line no-jquery/no-global-selector + var $editLink = $( '#p-lang-btn .wbc-editpage' ); + if ( $editLink.length ) { + // Use title attribute for link text + $editLink.text( $editLink.attr( 'title' ) || '' ); + var $li = $( '
  • ' ).append( $editLink ); + $li.appendTo( '#p-tb ul' ); + } +} + /** * Checks whether ULS is enabled and if so disables the default * drop down behavior of the button. @@ -13,7 +30,8 @@ function disableLanguageDropdown() { return; } if ( !pLangBtn.querySelectorAll( '.mw-interlanguage-selector' ).length ) { - // The ext.uls.interface module removed the selector, because the feature is disabled. Do nothing. + // The ext.uls.interface module removed the selector, + // because the feature is disabled. Do nothing. return; } pLangBtn.classList.add( 'vector-menu--hide-dropdown' ); @@ -35,4 +53,5 @@ function disableLanguageDropdown() { */ module.exports = function () { disableLanguageDropdown(); + addInterwikiLinkToSidebar(); }; diff --git a/resources/skins.vector.styles/components/LanguageButton.less b/resources/skins.vector.styles/components/LanguageButton.less index 5b5cf41b2..6380dd17c 100644 --- a/resources/skins.vector.styles/components/LanguageButton.less +++ b/resources/skins.vector.styles/components/LanguageButton.less @@ -93,3 +93,9 @@ } } } + +// Hides language button with CSS, ensures language button is in DOM for temporary JS hack for interwiki links +// Temporary solution to T287206, can be removed when ULS dialog includes interwiki links +#p-lang-btn.mw-portlet-empty { + display: none; +}