Merge "Revert "Add executable rights for executable (bash) files""
[lhc/web/wiklou.git] / includes / htmlform / HTMLSelectField.php
index 2bf9f8b..6ba6966 100644 (file)
@@ -29,7 +29,7 @@ class HTMLSelectField extends HTMLFormField {
 
                $allowedParams = array( 'tabindex', 'size' );
                $customParams = $this->getAttributes( $allowedParams );
-               foreach( $customParams as $name => $value ) {
+               foreach ( $customParams as $name => $value ) {
                        $select->setAttribute( $name, $value );
                }
 
@@ -41,4 +41,26 @@ class HTMLSelectField extends HTMLFormField {
 
                return $select->getHTML();
        }
+
+       function getInputOOUI( $value ) {
+               $disabled = false;
+               $allowedParams = array( 'tabindex' );
+               $attribs = $this->getAttributes( $allowedParams, array( 'tabindex' => 'tabIndex' ) );
+
+               if ( $this->mClass !== '' ) {
+                       $attribs['classes'] = array( $this->mClass );
+               }
+
+               if ( !empty( $this->mParams['disabled'] ) ) {
+                       $disabled = true;
+               }
+
+               return new OOUI\DropdownInputWidget( array(
+                       'name' => $this->mName,
+                       'id' => $this->mID,
+                       'options' => $this->getOptionsOOUI(),
+                       'value' => strval( $value ),
+                       'disabled' => $disabled,
+               ) + $attribs );
+       }
 }