MediaWiki  1.30.0
SelectWithInputWidget.php
Go to the documentation of this file.
1 <?php
8 namespace MediaWiki\Widget;
9 
10 use \OOUI\TextInputWidget;
11 use \OOUI\DropdownInputWidget;
12 
16 class SelectWithInputWidget extends \OOUI\Widget {
17 
18  protected $textinput = null;
19  protected $dropdowninput = null;
20 
30  public function __construct( array $config = [] ) {
31  // Configuration initialization
32  $config = array_merge(
33  [
34  'textinput' => [],
35  'dropdowninput' => [],
36  'or' => false
37  ],
38  $config
39  );
40 
41  // Parent constructor
42  parent::__construct( $config );
43 
44  // Properties
45  $this->config = $config;
46  $this->textinput = new TextInputWidget( $config['textinput'] );
47  $this->dropdowninput = new DropdownInputWidget( $config['dropdowninput'] );
48 
49  // Initialization
50  $this
51  ->addClasses( [ 'mw-widget-selectWithInputWidget' ] )
52  ->appendContent( $this->dropdowninput, $this->textinput );
53  }
54 
55  protected function getJavaScriptClassName() {
56  return 'mw.widgets.SelectWithInputWidget';
57  }
58 
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 );
64  }
65 }
MediaWiki\Widget\SelectWithInputWidget\$textinput
$textinput
Definition: SelectWithInputWidget.php:18
MediaWiki\Widget\SelectWithInputWidget
Select and input widget.
Definition: SelectWithInputWidget.php:16
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
MediaWiki\Widget\SelectWithInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition: SelectWithInputWidget.php:55
MediaWiki\Widget\SelectWithInputWidget\$dropdowninput
$dropdowninput
Definition: SelectWithInputWidget.php:19
MediaWiki\Widget
MediaWiki Widgets – ComplexNamespaceInputWidget class.
Definition: ComplexNamespaceInputWidget.php:8
MediaWiki\Widget\SelectWithInputWidget\getConfig
getConfig(&$config)
Definition: SelectWithInputWidget.php:59
MediaWiki\$config
Config $config
Definition: MediaWiki.php:42
MediaWiki\Widget\SelectWithInputWidget\__construct
__construct(array $config=[])
A version of the SelectWithInputWidget, with or set to true.
Definition: SelectWithInputWidget.php:30
array
the array() calling protocol came about after MediaWiki 1.4rc1.