Implement HTMLTitleTextField with suggestions for non-OOUI forms, too
[lhc/web/wiklou.git] / includes / htmlform / HTMLTextField.php
index c2606c2..fb7584b 100644 (file)
@@ -22,7 +22,7 @@ class HTMLTextField extends HTMLFormField {
                                'value' => $value,
                                'dir' => $this->mDir,
                                'spellcheck' => $this->getSpellCheck(),
-                       ] + $this->getTooltipAndAccessKey();
+                       ] + $this->getTooltipAndAccessKey() + $this->getDataAttribs();
 
                if ( $this->mClass !== '' ) {
                        $attribs['class'] = $this->mClass;
@@ -126,4 +126,13 @@ class HTMLTextField extends HTMLFormField {
        protected function getInputWidget( $params ) {
                return new OOUI\TextInputWidget( $params );
        }
+
+       /**
+        * Returns an array of data-* attributes to add to the field.
+        *
+        * @return array
+        */
+       protected function getDataAttribs() {
+               return [];
+       }
 }