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 bool $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' => [],
41 parent
::__construct( $config );
44 $this->config
= $config;
45 $this->textinput
= new TextInputWidget( $config['textinput'] );
46 $this->dropdowninput
= new DropdownInputWidget( $config['dropdowninput'] );
50 ->addClasses( [ 'mw-widget-selectWithInputWidget' ] )
51 ->appendContent( $this->dropdowninput
, $this->textinput
);
54 protected function getJavaScriptClassName() {
55 return 'mw.widgets.SelectWithInputWidget';
58 public function getConfig( &$config ) {
59 $config['textinput'] = $this->config
['textinput'];
60 $config['dropdowninput'] = $this->config
['dropdowninput'];
61 $config['or'] = $this->config
['or'];
62 return parent
::getConfig( $config );