Daniel Werner has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/211909

Change subject: "spellcheck" attribute for HTMLForm "text" and "textarea"
......................................................................

"spellcheck" attribute for HTMLForm "text" and "textarea"

"spellcheck" attribute requires literal "true" or "false" values and can not
just be implemented by adding it to the list of HTMLFormField::getAttributes's
$boolAttribs.

Change-Id: I5882e71af2ca64d367a1824634f61e16097e341d
---
M includes/htmlform/HTMLTextAreaField.php
M includes/htmlform/HTMLTextField.php
2 files changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/09/211909/1

diff --git a/includes/htmlform/HTMLTextAreaField.php 
b/includes/htmlform/HTMLTextAreaField.php
index 21173d2..c2b430d 100644
--- a/includes/htmlform/HTMLTextAreaField.php
+++ b/includes/htmlform/HTMLTextAreaField.php
@@ -12,11 +12,21 @@
                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 a67e52e..30f0630 100644
--- a/includes/htmlform/HTMLTextField.php
+++ b/includes/htmlform/HTMLTextField.php
@@ -5,6 +5,15 @@
                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 @@
                                'size' => $this->getSize(),
                                'value' => $value,
                                'dir' => $this->mDir,
+                               'spellcheck' => $this->getSpellcheck(),
                        ) + $this->getTooltipAndAccessKey();
 
                if ( $this->mClass !== '' ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/211909
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5882e71af2ca64d367a1824634f61e16097e341d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Werner <daniel.a.r.wer...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to