MediaWiki REL1_31
ComplexTitleInputWidget.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Widget;
4
11class 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' => isset( $config['namespace']['value'] ) ?
44 $config['namespace']['value'] :
45 null,
46 ]
47 ) );
48
49 // Initialization
50 $this
51 ->addClasses( [ 'mw-widget-complexTitleInputWidget' ] )
52 ->appendContent( $this->namespace, $this->title );
53 }
54
55 protected function getJavaScriptClassName() {
56 return 'mw.widgets.ComplexTitleInputWidget';
57 }
58
59 public function getConfig( &$config ) {
60 $config['namespace'] = $this->config['namespace'];
61 $config['namespace']['dropdown']['$overlay'] = true;
62 $config['title'] = $this->config['title'];
63 $config['title']['$overlay'] = true;
64 return parent::getConfig( $config );
65 }
66}
__construct(array $config=[])
Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.