Merge "Drop zh-tw message "saveprefs""
[lhc/web/wiklou.git] / includes / htmlform / HTMLTextAreaField.php
index 22e96f6..aeb4b7c 100644 (file)
@@ -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 !== '' ) {
@@ -37,6 +47,10 @@ class HTMLTextAreaField extends HTMLFormField {
        }
 
        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 !== '' ) {
@@ -62,6 +76,7 @@ class HTMLTextAreaField extends HTMLFormField {
                        'name' => $this->mName,
                        'multiline' => true,
                        'value' => $value,
+                       'rows' => $this->getRows(),
                ) + $attribs );
        }
 }