From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- includes/htmlform/HTMLTextAreaField.php | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'includes/htmlform/HTMLTextAreaField.php') diff --git a/includes/htmlform/HTMLTextAreaField.php b/includes/htmlform/HTMLTextAreaField.php index 21173d2a..aeb4b7c2 100644 --- a/includes/htmlform/HTMLTextAreaField.php +++ b/includes/htmlform/HTMLTextAreaField.php @@ -12,11 +12,21 @@ class HTMLTextAreaField extends HTMLFormField { return isset( $this->mParams['rows'] ) ? $this->mParams['rows'] : static::DEFAULT_ROWS; } + function getSpellCheck() { + $val = isset( $this->mParams['spellcheck'] ) ? $this->mParams['spellcheck'] : null; + if ( is_bool( $val ) ) { + // "spellcheck" attribute literally requires "true" or "false" to work. + return $val === true ? 'true' : 'false'; + } + return null; + } + function getInputHTML( $value ) { $attribs = array( 'id' => $this->mID, 'cols' => $this->getCols(), 'rows' => $this->getRows(), + 'spellcheck' => $this->getSpellCheck(), ) + $this->getTooltipAndAccessKey(); if ( $this->mClass !== '' ) { @@ -35,4 +45,38 @@ class HTMLTextAreaField extends HTMLFormField { $attribs += $this->getAttributes( $allowedParams ); return Html::textarea( $this->mName, $value, $attribs ); } + + function getInputOOUI( $value ) { + if ( isset( $this->mParams['cols'] ) ) { + throw new Exception( "OOUIHTMLForm does not support the 'cols' parameter for textareas" ); + } + + $attribs = $this->getTooltipAndAccessKey(); + + if ( $this->mClass !== '' ) { + $attribs['classes'] = array( $this->mClass ); + } + + $allowedParams = array( + 'placeholder', + 'tabindex', + 'disabled', + 'readonly', + 'required', + 'autofocus', + ); + + $attribs += $this->getAttributes( $allowedParams, array( + 'tabindex' => 'tabIndex', + 'readonly' => 'readOnly', + ) ); + + return new OOUI\TextInputWidget( array( + 'id' => $this->mID, + 'name' => $this->mName, + 'multiline' => true, + 'value' => $value, + 'rows' => $this->getRows(), + ) + $attribs ); + } } -- cgit v1.2.3-54-g00ecf