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