X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLSelectField.php;h=61916659035e9b8bb8845edc59d1f6ab2bfe5e59;hb=d716155c8b2d6e4a51a4110195cee7a1794846e8;hp=2bf9f8b82fcfa51b0644df2a65fbaf0121a7f76c;hpb=96484126651b7f2550df5a8cc4a998d19b27b73c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLSelectField.php b/includes/htmlform/HTMLSelectField.php index 2bf9f8b82f..6191665903 100644 --- a/includes/htmlform/HTMLSelectField.php +++ b/includes/htmlform/HTMLSelectField.php @@ -27,9 +27,9 @@ class HTMLSelectField extends HTMLFormField { $select->setAttribute( 'disabled', 'disabled' ); } - $allowedParams = array( 'tabindex', 'size' ); + $allowedParams = [ '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 = [ 'tabindex' ]; + $attribs = $this->getAttributes( $allowedParams, [ 'tabindex' => 'tabIndex' ] ); + + 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 ); + } }