Convert Special:DeletedContributions to use OOUI.
[lhc/web/wiklou.git] / includes / htmlform / HTMLSelectField.php
index a198037..b6ad46c 100644 (file)
@@ -27,7 +27,7 @@ class HTMLSelectField extends HTMLFormField {
                        $select->setAttribute( 'disabled', 'disabled' );
                }
 
-               $allowedParams = array( 'tabindex', 'size' );
+               $allowedParams = [ 'tabindex', 'size' ];
                $customParams = $this->getAttributes( $allowedParams );
                foreach ( $customParams as $name => $value ) {
                        $select->setAttribute( $name, $value );
@@ -41,4 +41,28 @@ class HTMLSelectField extends HTMLFormField {
 
                return $select->getHTML();
        }
+
+       function getInputOOUI( $value ) {
+               $disabled = false;
+               $allowedParams = [ 'tabindex' ];
+               $attribs = OOUI\Element::configFromHtmlAttributes(
+                       $this->getAttributes( $allowedParams )
+               );
+
+               if ( $this->mClass !== '' ) {
+                       $attribs['classes'] = [ $this->mClass ];
+               }
+
+               if ( !empty( $this->mParams['disabled'] ) ) {
+                       $disabled = true;
+               }
+
+               return new OOUI\DropdownInputWidget( [
+                       'name' => $this->mName,
+                       'id' => $this->mID,
+                       'options' => $this->getOptionsOOUI(),
+                       'value' => strval( $value ),
+                       'disabled' => $disabled,
+               ] + $attribs );
+       }
 }