MediaWiki
master
Toggle main menu visibility
SizeFilterWidget.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Widget;
4
5
use OOUI\LabelWidget;
6
use OOUI\RadioSelectInputWidget;
7
use OOUI\TextInputWidget;
8
use OOUI\Widget;
9
16
class
SizeFilterWidget
extends
Widget
{
18
protected
$config
;
20
protected
$label
;
22
protected
$radioselectinput
;
24
protected
$textinput
;
25
34
public
function
__construct
( array
$config
= [] ) {
35
// Configuration initialization
36
$config
= array_merge( [
37
'selectMin'
=>
true
,
38
'textinput'
=> [],
39
'radioselectinput'
=> []
40
],
$config
);
41
$config
[
'textinput'
] = array_merge( [
42
'type'
=>
'number'
43
],
$config
[
'textinput'
] );
44
$config
[
'radioselectinput'
] = array_merge( [
'options'
=> [
45
[
46
'data'
=>
'min'
,
47
'label'
=>
wfMessage
(
'minimum-size'
)->text()
48
],
49
[
50
'data'
=>
'max'
,
51
'label'
=>
wfMessage
(
'maximum-size'
)->text()
52
]
53
] ],
$config
[
'radioselectinput'
] );
54
55
// Parent constructor
56
parent::__construct(
$config
);
57
58
// Properties
59
$this->config =
$config
;
60
$this->radioselectinput =
new
RadioSelectInputWidget(
$config
[
'radioselectinput'
] );
61
$this->textinput =
new
TextInputWidget(
$config
[
'textinput'
] );
62
$this->label =
new
LabelWidget( [
'label'
=>
wfMessage
(
'pagesize'
)->text() ] );
63
64
// Initialization
65
$this->radioselectinput->setValue(
$config
[
'selectMin'
] ?
'min'
:
'max'
);
66
$this
67
->addClasses( [
'mw-widget-sizeFilterWidget'
] )
68
->appendContent( $this->radioselectinput, $this->textinput, $this->label );
69
}
70
72
protected
function
getJavaScriptClassName
() {
73
return
'mw.widgets.SizeFilterWidget'
;
74
}
75
77
public
function
getConfig
( &
$config
) {
78
$config
[
'textinput'
] = $this->config[
'textinput'
];
79
$config
[
'radioselectinput'
] = $this->config[
'radioselectinput'
];
80
$config
[
'selectMin'
] = $this->config[
'selectMin'
];
81
return
parent::getConfig(
$config
);
82
}
83
}
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition
GlobalFunctions.php:548
MediaWiki\Widget\SizeFilterWidget
Select and input widget.
Definition
SizeFilterWidget.php:16
MediaWiki\Widget\SizeFilterWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition
SizeFilterWidget.php:72
MediaWiki\Widget\SizeFilterWidget\getConfig
getConfig(&$config)
Definition
SizeFilterWidget.php:77
MediaWiki\Widget\SizeFilterWidget\$textinput
TextInputWidget $textinput
Definition
SizeFilterWidget.php:24
MediaWiki\Widget\SizeFilterWidget\__construct
__construct(array $config=[])
RadioSelectInputWidget and a TextInputWidget to set minimum or maximum byte size.
Definition
SizeFilterWidget.php:34
MediaWiki\Widget\SizeFilterWidget\$label
LabelWidget $label
Definition
SizeFilterWidget.php:20
MediaWiki\Widget\SizeFilterWidget\$radioselectinput
RadioSelectInputWidget $radioselectinput
Definition
SizeFilterWidget.php:22
MediaWiki\Widget\SizeFilterWidget\$config
array $config
Definition
SizeFilterWidget.php:18
MediaWiki\Widget
Definition
CheckMatrixWidget.php:3
includes
Widget
SizeFilterWidget.php
Generated on
for MediaWiki by
1.18.0