Esanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401760 )
Change subject: Add useEditFont param to TextAreaField ...................................................................... Add useEditFont param to TextAreaField Change-Id: I7c76e911b4d71842b49272186e880051eee8de2b --- M includes/htmlform/fields/HTMLTextAreaField.php M includes/specials/SpecialExpandTemplates.php 2 files changed, 22 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/60/401760/1 diff --git a/includes/htmlform/fields/HTMLTextAreaField.php b/includes/htmlform/fields/HTMLTextAreaField.php index 466a251..503da1b 100644 --- a/includes/htmlform/fields/HTMLTextAreaField.php +++ b/includes/htmlform/fields/HTMLTextAreaField.php @@ -5,6 +5,7 @@ const DEFAULT_ROWS = 25; protected $mPlaceholder = ''; + protected $mUseEditFont = false; /** * @param array $params @@ -19,6 +20,10 @@ $this->mPlaceholder = $this->getMessage( $params['placeholder-message'] )->text(); } elseif ( isset( $params['placeholder'] ) ) { $this->mPlaceholder = $params['placeholder']; + } + + if ( isset( $params['useeditfont'] ) ) { + $this->mUseEditFont = $params['useeditfont']; } } @@ -40,6 +45,8 @@ } public function getInputHTML( $value ) { + global $wgUser; + $attribs = [ 'id' => $this->mID, 'cols' => $this->getCols(), @@ -49,6 +56,12 @@ if ( $this->mClass !== '' ) { $attribs['class'] = $this->mClass; + } + if ( $this->mUseEditFont ) { + if ( !isset( $attribs['classes'] ) ) { + $attribs['classes'] = []; + } + array_push( $attribs['classes'], 'mw-editfont-' . $wgUser->getOption( 'editfont' ) ); } if ( $this->mPlaceholder !== '' ) { $attribs['placeholder'] = $this->mPlaceholder; @@ -67,6 +80,8 @@ } function getInputOOUI( $value ) { + global $wgUser; + if ( isset( $this->mParams['cols'] ) ) { throw new Exception( "OOUIHTMLForm does not support the 'cols' parameter for textareas" ); } @@ -76,6 +91,12 @@ if ( $this->mClass !== '' ) { $attribs['classes'] = [ $this->mClass ]; } + if ( $this->mUseEditFont ) { + if ( !isset( $attribs['classes'] ) ) { + $attribs['classes'] = []; + } + array_push( $attribs['classes'], 'mw-editfont-' . $wgUser->getOption( 'editfont' ) ); + } if ( $this->mPlaceholder !== '' ) { $attribs['placeholder'] = $this->mPlaceholder; } diff --git a/includes/specials/SpecialExpandTemplates.php b/includes/specials/SpecialExpandTemplates.php index 35344aa..cb318d1 100644 --- a/includes/specials/SpecialExpandTemplates.php +++ b/includes/specials/SpecialExpandTemplates.php @@ -172,11 +172,7 @@ 'rows' => 10, 'default' => $input, 'id' => 'input', - // The following classes can be used here: - // * mw-editfont-monospace - // * mw-editfont-sans-serif - // * mw-editfont-serif - 'cssclass' => 'mw-editfont-' . $this->getUser()->getOption( 'editfont' ), + 'useeditfont' => true, ], 'removecomments' => [ 'type' => 'check', -- To view, visit https://gerrit.wikimedia.org/r/401760 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c76e911b4d71842b49272186e880051eee8de2b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits