Merge "Use interwiki cache directly to resolve transwiki import sources"
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index 5d405c3..2e3fdb0 100644 (file)
@@ -11,7 +11,7 @@ abstract class HTMLFormField {
        protected $mFilterCallback;
        protected $mName;
        protected $mDir;
-       protected $mLabel; # String label.  Set on construction
+       protected $mLabel; # String label, as HTML. Set on construction.
        protected $mID;
        protected $mClass = '';
        protected $mVFormClass = '';
@@ -601,7 +601,7 @@ abstract class HTMLFormField {
                $config = array(
                        'classes' => array( "mw-htmlform-field-$fieldType", $this->mClass ),
                        'align' => $this->getLabelAlignOOUI(),
-                       'label' => $this->getLabel(),
+                       'label' => new OOUI\HtmlSnippet( $this->getLabel() ),
                        'help' => $helpText !== null ? new OOUI\HtmlSnippet( $helpText ) : null,
                        'errors' => $errors,
                        'infusable' => $infusable,
@@ -837,7 +837,7 @@ abstract class HTMLFormField {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getLabel() {
                return is_null( $this->mLabel ) ? '' : $this->mLabel;
@@ -925,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 ) {
@@ -937,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];