Merge "Handle null data return in HTMLForm"
[lhc/web/wiklou.git] / includes / htmlform / HTMLCheckField.php
index 13f30c2..4a6b804 100644 (file)
@@ -56,9 +56,8 @@ class HTMLCheckField extends HTMLFormField {
                $attr['id'] = $this->mID;
                $attr['name'] = $this->mName;
 
-               $attr += $this->getAttributes(
-                       [ 'disabled', 'tabindex' ],
-                       [ 'tabindex' => 'tabIndex' ]
+               $attr += OOUI\Element::configFromHtmlAttributes(
+                       $this->getAttributes( [ 'disabled', 'tabindex' ] )
                );
 
                if ( $this->mClass !== '' ) {
@@ -112,7 +111,7 @@ class HTMLCheckField extends HTMLFormField {
        /**
         * @param WebRequest $request
         *
-        * @return string
+        * @return bool
         */
        function loadDataFromRequest( $request ) {
                $invert = isset( $this->mParams['invert'] ) && $this->mParams['invert'];
@@ -126,7 +125,7 @@ class HTMLCheckField extends HTMLFormField {
                                ? !$request->getBool( $this->mName )
                                : $request->getBool( $this->mName );
                } else {
-                       return $this->getDefault();
+                       return (bool)$this->getDefault();
                }
        }
 }