MediaWiki REL1_30
ComplexTitleInputWidget.php
Go to the documentation of this file.
1<?php
8namespace MediaWiki\Widget;
9
13class 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}
__construct(array $config=[])
Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.
MediaWiki Widgets – ComplexNamespaceInputWidget class.