MediaWiki  1.30.0
ComplexTitleInputWidget.php
Go to the documentation of this file.
1 <?php
8 namespace MediaWiki\Widget;
9 
13 class ComplexTitleInputWidget extends \OOUI\Widget {
14 
15  protected $namespace = null;
16  protected $title = null;
17 
26  public function __construct( array $config = [] ) {
27  // Configuration initialization
28  $config = array_merge(
29  [
30  'namespace' => [],
31  'title' => [],
32  ],
33  $config
34  );
35 
36  // Parent constructor
37  parent::__construct( $config );
38 
39  // Properties
40  $this->config = $config;
41  $this->namespace = new NamespaceInputWidget( $config['namespace'] );
42  $this->title = new TitleInputWidget( array_merge(
43  $config['title'],
44  [
45  'relative' => true,
46  'namespace' => isset( $config['namespace']['value'] ) ?
47  $config['namespace']['value'] :
48  null,
49  ]
50  ) );
51 
52  // Initialization
53  $this
54  ->addClasses( [ 'mw-widget-complexTitleInputWidget' ] )
55  ->appendContent( $this->namespace, $this->title );
56  }
57 
58  protected function getJavaScriptClassName() {
59  return 'mw.widgets.ComplexTitleInputWidget';
60  }
61 
62  public function getConfig( &$config ) {
63  $config['namespace'] = $this->config['namespace'];
64  $config['title'] = $this->config['title'];
65  return parent::getConfig( $config );
66  }
67 }
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
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2696
MediaWiki\Widget\ComplexTitleInputWidget
Complex title input widget.
Definition: ComplexTitleInputWidget.php:13
MediaWiki\Widget\ComplexTitleInputWidget\$namespace
$namespace
Definition: ComplexTitleInputWidget.php:15
MediaWiki\Widget\NamespaceInputWidget
Namespace input widget.
Definition: NamespaceInputWidget.php:13
MediaWiki\Widget\TitleInputWidget
Title input widget.
Definition: TitleInputWidget.php:13
MediaWiki\Widget\ComplexTitleInputWidget\$title
$title
Definition: ComplexTitleInputWidget.php:16
MediaWiki\Widget
MediaWiki Widgets – ComplexNamespaceInputWidget class.
Definition: ComplexNamespaceInputWidget.php:8
MediaWiki\Widget\ComplexTitleInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition: ComplexTitleInputWidget.php:58
MediaWiki\$config
Config $config
Definition: MediaWiki.php:42
MediaWiki\Widget\ComplexTitleInputWidget\__construct
__construct(array $config=[])
Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.
Definition: ComplexTitleInputWidget.php:26
MediaWiki\Widget\ComplexTitleInputWidget\getConfig
getConfig(&$config)
Definition: ComplexTitleInputWidget.php:62
array
the array() calling protocol came about after MediaWiki 1.4rc1.