Revert "Use array instead of string for class list"

This reverts commit c12f61709b.

Reason for revert: Does not work and broke the train

Bug: T378531
Change-Id: I3a91169276b8ebffbdf409aac4e3731298047196
This commit is contained in:
Ammarpad 2024-10-30 12:30:08 +00:00
parent ecd660e0f7
commit 7b819ad803
2 changed files with 8 additions and 8 deletions

View file

@ -32,8 +32,8 @@ class LanguageSelectorEntry implements IMenuEntry {
private string $icon; private string $icon;
/** @var string A translatable label used as text and title */ /** @var string A translatable label used as text and title */
private string $label; private string $label;
/** @var array additional classes */ /** @var string additional classes */
private array $classes; private string $classes;
/** /**
* LanguageSelectorEntry constructor. * LanguageSelectorEntry constructor.
@ -42,7 +42,7 @@ class LanguageSelectorEntry implements IMenuEntry {
* languages or variants * languages or variants
* @param MessageLocalizer $messageLocalizer Used for translation texts * @param MessageLocalizer $messageLocalizer Used for translation texts
* @param bool $isButton * @param bool $isButton
* @param array $classes page classes * @param string $classes page classes
* @param string $label Menu entry label and title * @param string $label Menu entry label and title
*/ */
public function __construct( public function __construct(
@ -50,7 +50,7 @@ class LanguageSelectorEntry implements IMenuEntry {
$doesPageHaveLanguages, $doesPageHaveLanguages,
MessageLocalizer $messageLocalizer, MessageLocalizer $messageLocalizer,
$isButton = false, $isButton = false,
array $classes = [], $classes = '',
$label = 'mobile-frontend-language-article-heading' $label = 'mobile-frontend-language-article-heading'
) { ) {
$this->title = $title; $this->title = $title;
@ -80,19 +80,19 @@ class LanguageSelectorEntry implements IMenuEntry {
*/ */
public function getComponents(): array { public function getComponents(): array {
$switcherLink = false; $switcherLink = false;
$switcherClasses = [ 'language-selector' ]; $switcherClasses = ' language-selector';
if ( $this->doesPageHaveLanguages ) { if ( $this->doesPageHaveLanguages ) {
$switcherLink = '#p-lang'; $switcherLink = '#p-lang';
} else { } else {
$switcherClasses[] = 'disabled'; $switcherClasses .= ' disabled';
} }
$msg = $this->messageLocalizer->msg( $this->label ); $msg = $this->messageLocalizer->msg( $this->label );
return [ return [
[ [
'tag-name' => 'a', 'tag-name' => 'a',
'classes' => $this->classes + $switcherClasses, 'classes' => $this->classes . ' ' . $switcherClasses,
'label' => $msg, 'label' => $msg,
'data-icon' => [ 'data-icon' => [
'icon' => $this->icon, 'icon' => $this->icon,

View file

@ -66,7 +66,7 @@ class UserNamespaceOverflowBuilder extends DefaultOverflowBuilder {
$this->getMessageLocalizer(), $this->getMessageLocalizer(),
false, false,
// no additional classes // no additional classes
[], '',
'minerva-page-actions-language-switcher' 'minerva-page-actions-language-switcher'
) ); ) );
} }