Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
HTMLLargeMultiSelectField
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
30
0.00% covered (danger)
0.00%
0 / 1
 getInputHTML
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2
3use MediaWiki\Html\Html;
4use MediaWiki\HTMLForm\Field\HTMLMultiSelectField;
5use MediaWiki\Xml\Xml;
6
7class HTMLLargeMultiSelectField extends HTMLMultiSelectField {
8    public function getInputHTML( $value ) {
9        if ( !is_array( $value ) ) {
10            $value = [ $value ];
11        }
12
13        $options = "\n";
14        foreach ( $this->mParams[ 'options' ] as $name => $optvalue ) {
15            $options .= Xml::option(
16                (string)$name,
17                $optvalue,
18                in_array( $optvalue, $value )
19            ) . "\n";
20        }
21
22        $properties = [
23            'multiple' => 'multiple',
24            'id' => $this->mID,
25            'name' => "$this->mName[]",
26        ];
27
28        if ( !empty( $this->mParams[ 'disabled' ] ) ) {
29            $properties[ 'disabled' ] = 'disabled';
30        }
31
32        if ( !empty( $this->mParams[ 'cssclass' ] ) ) {
33            $properties[ 'class' ] = $this->mParams[ 'cssclass' ];
34        }
35
36        return Html::rawElement( 'select', $properties, $options );
37    }
38}