MediaWiki  1.32.5
ComplexTitleInputWidget.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Widget;
4 
11 class ComplexTitleInputWidget extends \OOUI\Widget {
12 
13  protected $namespace = null;
14  protected $title = null;
15 
24  public function __construct( array $config = [] ) {
25  // Configuration initialization
26  $config = array_merge(
27  [
28  'namespace' => [],
29  'title' => [],
30  ],
31  $config
32  );
33 
34  parent::__construct( $config );
35 
36  // Properties
37  $this->config = $config;
38  $this->namespace = new NamespaceInputWidget( $config['namespace'] );
39  $this->title = new TitleInputWidget( array_merge(
40  $config['title'],
41  [
42  'relative' => true,
43  'namespace' => $config['namespace']['value'] ?? null,
44  ]
45  ) );
46 
47  // Initialization
48  $this
49  ->addClasses( [ 'mw-widget-complexTitleInputWidget' ] )
50  ->appendContent( $this->namespace, $this->title );
51  }
52 
53  protected function getJavaScriptClassName() {
54  return 'mw.widgets.ComplexTitleInputWidget';
55  }
56 
57  public function getConfig( &$config ) {
58  $config['namespace'] = $this->config['namespace'];
59  $config['namespace']['dropdown']['$overlay'] = true;
60  $config['title'] = $this->config['title'];
61  $config['title']['$overlay'] = true;
62  return parent::getConfig( $config );
63  }
64 }
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\ComplexTitleInputWidget
Complex title input widget.
Definition: ComplexTitleInputWidget.php:11
MediaWiki\Widget\ComplexTitleInputWidget\$namespace
$namespace
Definition: ComplexTitleInputWidget.php:13
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
MediaWiki\Widget\NamespaceInputWidget
Namespace input widget.
Definition: NamespaceInputWidget.php:11
title
title
Definition: parserTests.txt:239
MediaWiki\Widget\TitleInputWidget
Title input widget.
Definition: TitleInputWidget.php:11
MediaWiki\Widget\ComplexTitleInputWidget\$title
$title
Definition: ComplexTitleInputWidget.php:14
MediaWiki\Widget
Definition: CheckMatrixWidget.php:3
MediaWiki\Widget\ComplexTitleInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition: ComplexTitleInputWidget.php:53
MediaWiki\$config
Config $config
Definition: MediaWiki.php:43
MediaWiki\Widget\ComplexTitleInputWidget\__construct
__construct(array $config=[])
Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.
Definition: ComplexTitleInputWidget.php:24
MediaWiki\Widget\ComplexTitleInputWidget\getConfig
getConfig(&$config)
Definition: ComplexTitleInputWidget.php:57