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( array_merge(
70
[
'value'
=>
'1'
],
71
$config
[
'associated'
]
72
) );
73
// TODO Should use a LabelWidget? But they don't work like HTML <label>s yet
74
$this->associatedLabel =
new
FieldLayout(
75
$this->associated,
76
array_merge(
77
[
'align'
=>
'inline'
],
78
$config
[
'associatedLabel'
]
79
)
80
);
81
}
82
if
(
$config
[
'invert'
] !==
null
) {
83
$this->invert =
new
CheckboxInputWidget( array_merge(
84
[
'value'
=>
'1'
],
85
$config
[
'invert'
]
86
) );
87
// TODO Should use a LabelWidget? But they don't work like HTML <label>s yet
88
$this->invertLabel =
new
FieldLayout(
89
$this->invert,
90
array_merge(
91
[
'align'
=>
'inline'
],
92
$config
[
'invertLabel'
]
93
)
94
);
95
}
96
97
// Initialization
98
$this
99
->addClasses( [
'mw-widget-complexNamespaceInputWidget'
] )
100
->appendContent( $this->
namespace
, $this->associatedLabel, $this->invertLabel );
101
}
102
104
protected
function
getJavaScriptClassName
() {
105
return
'mw.widgets.ComplexNamespaceInputWidget'
;
106
}
107
109
public
function
getConfig
( &
$config
) {
110
$config
= array_merge(
111
$config
,
112
array_intersect_key(
113
$this->config,
114
array_fill_keys(
115
[
116
'namespace'
,
117
'invert'
,
118
'invertLabel'
,
119
'associated'
,
120
'associatedLabel'
121
],
122
true
123
)
124
)
125
);
126
$config
[
'namespace'
][
'dropdown'
][
'$overlay'
] =
true
;
127
return
parent::getConfig(
$config
);
128
}
129
}
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:104
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:109
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 Sun Jun 22 2025 08:27:09 for MediaWiki by
1.10.0