3 * MediaWiki Widgets – SelectWithInputWidget class.
5 * @copyright 2011-2017 MediaWiki Widgets Team and others; see AUTHORS.txt
6 * @license The MIT License (MIT); see LICENSE.txt
8 namespace MediaWiki\Widget
;
10 use \OOUI\TextInputWidget
;
11 use \OOUI\DropdownInputWidget
;
14 * Select and input widget.
16 class SelectWithInputWidget
extends \OOUI\Widget
{
18 protected $textinput = null;
19 protected $dropdowninput = null;
22 * A version of the SelectWithInputWidget, with `or` set to true.
24 * @param array $config Configuration options
25 * @param array $config['textinput'] Configuration for the TextInputWidget
26 * @param array $config['dropdowninput'] Configuration for the DropdownInputWidget
27 * @param boolean $config['or'] Configuration for whether the widget is dropdown AND input
28 * or dropdown OR input
30 public function __construct( array $config = [] ) {
31 // Configuration initialization
32 $config = array_merge(
35 'dropdowninput' => [],
42 parent
::__construct( $config );
45 $this->config
= $config;
46 $this->textinput
= new TextInputWidget( $config['textinput'] );
47 $this->dropdowninput
= new DropdownInputWidget( $config['dropdowninput'] );
51 ->addClasses( [ 'mw-widget-selectWithInputWidget' ] )
52 ->appendContent( $this->dropdowninput
, $this->textinput
);
55 protected function getJavaScriptClassName() {
56 return 'mw.widgets.SelectWithInputWidget';
59 public function getConfig( &$config ) {
60 $config['textinput'] = $this->config
['textinput'];
61 $config['dropdowninput'] = $this->config
['dropdowninput'];
62 $config['or'] = $this->config
['or'];
63 return parent
::getConfig( $config );