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
{
13 protected $namespace = null;
14 protected $title = null;
17 * Like TitleInputWidget, but the namespace has to be input through a separate dropdown field.
19 * @param array $config Configuration options
20 * - array $config['namespace'] Configuration for the NamespaceInputWidget dropdown
21 * with list of namespaces
22 * - array $config['title'] Configuration for the TitleInputWidget text field
24 public function __construct( array $config = [] ) {
25 // Configuration initialization
26 $config = array_merge(
34 parent
::__construct( $config );
37 $this->config
= $config;
38 $this->namespace = new NamespaceInputWidget( $config['namespace'] );
39 $this->title
= new TitleInputWidget( array_merge(
43 'namespace' => $config['namespace']['value'] ??
null,
49 ->addClasses( [ 'mw-widget-complexTitleInputWidget' ] )
50 ->appendContent( $this->namespace, $this->title
);
53 protected function getJavaScriptClassName() {
54 return 'mw.widgets.ComplexTitleInputWidget';
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 );