MediaWiki
master
ComplexNamespaceInputWidget.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Widget
;
4
5
use OOUI\CheckboxInputWidget;
6
use OOUI\FieldLayout;
7
use OOUI\Widget;
8
16
class
ComplexNamespaceInputWidget
extends
Widget {
17
19
protected
$config
;
21
protected
$namespace
;
23
protected
$associated
=
null
;
25
protected
$associatedLabel
=
null
;
27
protected
$invert
=
null
;
29
protected
$invertLabel
=
null
;
30
48
public
function
__construct
( array
$config
= [] ) {
49
// Configuration initialization
50
$config
= array_merge(
51
[
52
// Config options for nested widgets
53
'namespace'
=> [],
54
'invert'
=> [],
55
'invertLabel'
=> [],
56
'associated'
=> [],
57
'associatedLabel'
=> [],
58
],
59
$config
60
);
61
62
parent::__construct(
$config
);
63
64
// Properties
65
$this->config =
$config
;
66
67
$this->
namespace
= new
NamespaceInputWidget
(
$config
['namespace'] );
68
if
(
$config
[
'associated'
] !==
null
) {
69
$this->associated =
new
CheckboxInputWidget(
70
$config
[
'associated'
] + [
'value'
=>
'1'
]
71
);
72
// TODO Should use a LabelWidget? But they don't work like HTML <label>s yet
73
$this->associatedLabel =
new
FieldLayout(
74
$this->associated,
75
$config
[
'associatedLabel'
] + [
'align'
=>
'inline'
]
76
);
77
}
78
if
(
$config
[
'invert'
] !==
null
) {
79
$this->invert =
new
CheckboxInputWidget(
80
$config
[
'invert'
] + [
'value'
=>
'1'
]
81
);
82
// TODO Should use a LabelWidget? But they don't work like HTML <label>s yet
83
$this->invertLabel =
new
FieldLayout(
84
$this->invert,
85
$config
[
'invertLabel'
] + [
'align'
=>
'inline'
]
86
);
87
}
88
89
// Initialization
90
$this
91
->addClasses( [
'mw-widget-complexNamespaceInputWidget'
] )
92
->appendContent( $this->
namespace
, $this->associatedLabel, $this->invertLabel );
93
}
94
96
protected
function
getJavaScriptClassName
() {
97
return
'mw.widgets.ComplexNamespaceInputWidget'
;
98
}
99
101
public
function
getConfig
( &
$config
) {
102
$config
= array_merge(
103
$config
,
104
array_intersect_key(
105
$this->config,
106
array_fill_keys(
107
[
108
'namespace'
,
109
'invert'
,
110
'invertLabel'
,
111
'associated'
,
112
'associatedLabel'
113
],
114
true
115
)
116
)
117
);
118
$config
[
'namespace'
][
'dropdown'
][
'$overlay'
] =
true
;
119
return
parent::getConfig(
$config
);
120
}
121
}
MediaWiki\Widget\ComplexNamespaceInputWidget
Namespace input widget.
Definition
ComplexNamespaceInputWidget.php:16
MediaWiki\Widget\ComplexNamespaceInputWidget\$config
array $config
Definition
ComplexNamespaceInputWidget.php:19
MediaWiki\Widget\ComplexNamespaceInputWidget\$associatedLabel
FieldLayout null $associatedLabel
Definition
ComplexNamespaceInputWidget.php:25
MediaWiki\Widget\ComplexNamespaceInputWidget\$invertLabel
FieldLayout null $invertLabel
Definition
ComplexNamespaceInputWidget.php:29
MediaWiki\Widget\ComplexNamespaceInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition
ComplexNamespaceInputWidget.php:96
MediaWiki\Widget\ComplexNamespaceInputWidget\$namespace
NamespaceInputWidget $namespace
Definition
ComplexNamespaceInputWidget.php:21
MediaWiki\Widget\ComplexNamespaceInputWidget\$associated
CheckboxInputWidget null $associated
Definition
ComplexNamespaceInputWidget.php:23
MediaWiki\Widget\ComplexNamespaceInputWidget\__construct
__construct(array $config=[])
Definition
ComplexNamespaceInputWidget.php:48
MediaWiki\Widget\ComplexNamespaceInputWidget\getConfig
getConfig(&$config)
Definition
ComplexNamespaceInputWidget.php:101
MediaWiki\Widget\ComplexNamespaceInputWidget\$invert
CheckboxInputWidget null $invert
Definition
ComplexNamespaceInputWidget.php:27
MediaWiki\Widget\NamespaceInputWidget
Namespace input widget.
Definition
NamespaceInputWidget.php:15
MediaWiki\Widget
Definition
CheckMatrixWidget.php:3
includes
Widget
ComplexNamespaceInputWidget.php
Generated on Fri Jan 16 2026 02:28:40 for MediaWiki by
1.10.0