MediaWiki
master
SelectWithInputWidget.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Widget
;
4
5
use OOUI\DropdownInputWidget;
6
use OOUI\TextInputWidget;
7
use OOUI\Widget;
8
15
class
SelectWithInputWidget
extends
Widget {
17
protected
$config
;
19
protected
$textinput
;
21
protected
$dropdowninput
;
22
33
public
function
__construct
( array
$config
= [] ) {
34
// Configuration initialization
35
$config
= array_merge(
36
[
37
'textinput'
=> [],
38
'dropdowninput'
=> [],
39
'or'
=>
false
,
40
'required'
=>
false
,
41
],
42
$config
43
);
44
45
if
( isset(
$config
[
'disabled'
] ) &&
$config
[
'disabled'
] ) {
46
$config
[
'textinput'
][
'disabled'
] =
true
;
47
$config
[
'dropdowninput'
][
'disabled'
] =
true
;
48
}
49
50
$config
[
'textinput'
][
'required'
] =
$config
[
'or'
] ? false :
$config
[
'required'
];
51
$config
[
'dropdowninput'
][
'required'
] =
$config
[
'required'
];
52
53
parent::__construct(
$config
);
54
55
// Properties
56
$this->config =
$config
;
57
$this->textinput =
new
TextInputWidget(
$config
[
'textinput'
] );
58
$this->dropdowninput =
new
DropdownInputWidget(
$config
[
'dropdowninput'
] );
59
60
// Initialization
61
$this
62
->addClasses( [
'mw-widget-selectWithInputWidget'
] )
63
->appendContent( $this->dropdowninput, $this->textinput );
64
}
65
66
protected
function
getJavaScriptClassName
() {
67
return
'mw.widgets.SelectWithInputWidget'
;
68
}
69
70
public
function
getConfig
( &
$config
) {
71
$config
[
'textinput'
] = $this->config[
'textinput'
];
72
$config
[
'dropdowninput'
] = $this->config[
'dropdowninput'
];
73
$config
[
'dropdowninput'
][
'dropdown'
][
'$overlay'
] =
true
;
74
$config
[
'or'
] = $this->config[
'or'
];
75
$config
[
'required'
] = $this->config[
'required'
];
76
return
parent::getConfig(
$config
);
77
}
78
}
MediaWiki\Widget\SelectWithInputWidget
Select and input widget.
Definition
SelectWithInputWidget.php:15
MediaWiki\Widget\SelectWithInputWidget\$textinput
TextInputWidget $textinput
Definition
SelectWithInputWidget.php:19
MediaWiki\Widget\SelectWithInputWidget\$config
array $config
Definition
SelectWithInputWidget.php:17
MediaWiki\Widget\SelectWithInputWidget\$dropdowninput
DropdownInputWidget $dropdowninput
Definition
SelectWithInputWidget.php:21
MediaWiki\Widget\SelectWithInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition
SelectWithInputWidget.php:66
MediaWiki\Widget\SelectWithInputWidget\getConfig
getConfig(&$config)
Definition
SelectWithInputWidget.php:70
MediaWiki\Widget\SelectWithInputWidget\__construct
__construct(array $config=[])
A version of the SelectWithInputWidget, with or set to true.
Definition
SelectWithInputWidget.php:33
MediaWiki\Widget
Definition
CheckMatrixWidget.php:3
includes
widget
SelectWithInputWidget.php
Generated on Sat Nov 2 2024 20:26:49 for MediaWiki by
1.10.0