MediaWiki REL1_31
SelectWithInputWidget.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Widget;
4
5use OOUI\DropdownInputWidget;
6use OOUI\TextInputWidget;
7
14class SelectWithInputWidget extends \OOUI\Widget {
15
16 protected $textinput = null;
17 protected $dropdowninput = null;
18
28 public function __construct( array $config = [] ) {
29 // Configuration initialization
30 $config = array_merge(
31 [
32 'textinput' => [],
33 'dropdowninput' => [],
34 'or' => false
35 ],
36 $config
37 );
38
39 parent::__construct( $config );
40
41 // Properties
42 $this->config = $config;
43 $this->textinput = new TextInputWidget( $config['textinput'] );
44 $this->dropdowninput = new DropdownInputWidget( $config['dropdowninput'] );
45
46 // Initialization
47 $this
48 ->addClasses( [ 'mw-widget-selectWithInputWidget' ] )
49 ->appendContent( $this->dropdowninput, $this->textinput );
50 }
51
52 protected function getJavaScriptClassName() {
53 return 'mw.widgets.SelectWithInputWidget';
54 }
55
56 public function getConfig( &$config ) {
57 $config['textinput'] = $this->config['textinput'];
58 $config['dropdowninput'] = $this->config['dropdowninput'];
59 $config['dropdowninput']['dropdown']['$overlay'] = true;
60 $config['or'] = $this->config['or'];
61 return parent::getConfig( $config );
62 }
63}
__construct(array $config=[])
A version of the SelectWithInputWidget, with or set to true.