Merge "Revert "mediawiki.widgets: Add temporary workaround for upstream oojs-ui bug""
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index 0fab033..20d7250 100644 (file)
@@ -55,6 +55,15 @@ abstract class HTMLFormField {
                return false;
        }
 
+       /**
+        * True if this field type is able to display errors; false if validation errors need to be
+        * displayed in the main HTMLForm error area.
+        * @return bool
+        */
+       public function canDisplayErrors() {
+               return true;
+       }
+
        /**
         * Get a translated interface message
         *
@@ -916,11 +925,12 @@ abstract class HTMLFormField {
         * Returns the given attributes from the parameters
         *
         * @param array $list List of attributes to get
-        * @param array $mappings Optional - Key/value map of attribute names to use instead of the ones passed in
+        * @param array $mappings Optional - Key/value map of attribute names to use
+        *   instead of the ones passed in.
         * @return array Attributes
         */
        public function getAttributes( array $list, array $mappings = null ) {
-               static $boolAttribs = array( 'disabled', 'required', 'multiple', 'readonly' );
+               static $boolAttribs = array( 'disabled', 'required', 'autofocus', 'multiple', 'readonly' );
 
                $ret = array();
                foreach ( $list as $key ) {
@@ -928,7 +938,7 @@ abstract class HTMLFormField {
 
                        if ( in_array( $key, $boolAttribs ) ) {
                                if ( !empty( $this->mParams[$key] ) ) {
-                                       $ret[$mappedKey] = '';
+                                       $ret[$mappedKey] = $mappedKey;
                                }
                        } elseif ( isset( $this->mParams[$key] ) ) {
                                $ret[$mappedKey] = $this->mParams[$key];