From b4b178f4b9d5cc00a4937f542c2e94e3c426169d Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Sat, 8 Oct 2016 18:18:06 +0000 Subject: [PATCH] Fix merging of class attribute on edit page textbox Follow up to 2c688cfb11ea6cee0e975ed35fc8e503ea Bug: T147701 Change-Id: I48a03ffefb575470804dc4ef54bdf321e6f55dc3 --- includes/EditPage.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 8ca7105684..8226da5a78 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3300,17 +3300,28 @@ HTML 'id' => $name, 'cols' => $wgUser->getIntOption( 'cols' ), 'rows' => $wgUser->getIntOption( 'rows' ), - // The following classes can be used here: - // * mw-editfont-default - // * mw-editfont-monospace - // * mw-editfont-sans-serif - // * mw-editfont-serif - 'class' => 'mw-editfont-' . $wgUser->getOption( 'editfont' ), // Avoid PHP notices when appending preferences // (appending allows customAttribs['style'] to still work). 'style' => '' ]; + // The following classes can be used here: + // * mw-editfont-default + // * mw-editfont-monospace + // * mw-editfont-sans-serif + // * mw-editfont-serif + $class = 'mw-editfont-' . $wgUser->getOption( 'editfont' ); + + if ( isset( $attribs['class'] ) ) { + if ( is_string( $attribs['class'] ) ) { + $attribs['class'] .= ' ' . $class; + } elseif ( is_array( $attribs['class'] ) ) { + $attribs['class'][] = $class; + } + } else { + $attribs['class'] = $class; + } + $pageLang = $this->mTitle->getPageLanguage(); $attribs['lang'] = $pageLang->getHtmlCode(); $attribs['dir'] = $pageLang->getDir(); -- 2.20.1