diff --git a/includes/htmlform/HTMLTextAreaField.php b/includes/htmlform/HTMLTextAreaField.php index 22e96f614e2..a4ed95fb720 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 !== '' ) { diff --git a/includes/htmlform/HTMLTextField.php b/includes/htmlform/HTMLTextField.php index 2958274255f..06b397f2a7b 100644 --- a/includes/htmlform/HTMLTextField.php +++ b/includes/htmlform/HTMLTextField.php @@ -5,6 +5,15 @@ class HTMLTextField extends HTMLFormField { return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45; } + 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, @@ -12,6 +21,7 @@ class HTMLTextField extends HTMLFormField { 'size' => $this->getSize(), 'value' => $value, 'dir' => $this->mDir, + 'spellcheck' => $this->getSpellCheck(), ) + $this->getTooltipAndAccessKey(); if ( $this->mClass !== '' ) {