3 namespace MediaWiki\Widget
;
6 * Complex title input widget.
8 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
11 class ComplexTitleInputWidget
extends \OOUI\Widget
{
14 protected $namespace = null;
15 protected $title = null;
18 * Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.
20 * @param array $config Configuration options
21 * - array $config['namespace'] Configuration for the NamespaceInputWidget dropdown
22 * with list of namespaces
23 * - array $config['title'] Configuration for the TitleInputWidget text field
24 * @phan-param array{namespace?:array,title?:array} $config
26 public function __construct( array $config = [] ) {
27 // Configuration initialization
28 $config = array_merge(
36 parent
::__construct( $config );
39 $this->config
= $config;
40 $this->namespace = new NamespaceInputWidget( $config['namespace'] );
41 $this->title
= new TitleInputWidget( array_merge(
45 'namespace' => $config['namespace']['value'] ??
null,
51 ->addClasses( [ 'mw-widget-complexTitleInputWidget' ] )
52 ->appendContent( $this->namespace, $this->title
);
55 protected function getJavaScriptClassName() {
56 return 'mw.widgets.ComplexTitleInputWidget';
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 );