Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1427883
SizeFilterWidget.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
SizeFilterWidget.php
View Options
<?php
namespace
MediaWiki\Widget
;
use
OOUI\LabelWidget
;
use
OOUI\RadioSelectInputWidget
;
use
OOUI\TextInputWidget
;
use
OOUI\Widget
;
/**
* Select and input widget.
*
* @copyright 2011-2018 MediaWiki Widgets Team and others; see AUTHORS.txt
* @license MIT
*/
class
SizeFilterWidget
extends
Widget
{
/** @var array */
protected
$config
;
/** @var LabelWidget */
protected
$label
;
/** @var RadioSelectInputWidget */
protected
$radioselectinput
;
/** @var TextInputWidget */
protected
$textinput
;
/**
* RadioSelectInputWidget and a TextInputWidget to set minimum or maximum byte size
*
* @param array $config Configuration options
* - array $config['textinput'] Configuration for the TextInputWidget
* - array $config['radioselectinput'] Configuration for the RadioSelectWidget
* - bool $config['selectMin'] Whether to select 'min', false would select 'max'
*/
public
function
__construct
(
array
$config
=
[]
)
{
// Configuration initialization
$config
=
array_merge
(
[
'selectMin'
=>
true
,
'textinput'
=>
[],
'radioselectinput'
=>
[]
],
$config
);
$config
[
'textinput'
]
=
array_merge
(
[
'type'
=>
'number'
],
$config
[
'textinput'
]
);
$config
[
'radioselectinput'
]
=
array_merge
(
[
'options'
=>
[
[
'data'
=>
'min'
,
'label'
=>
wfMessage
(
'minimum-size'
)->
text
()
],
[
'data'
=>
'max'
,
'label'
=>
wfMessage
(
'maximum-size'
)->
text
()
]
]
],
$config
[
'radioselectinput'
]
);
// Parent constructor
parent
::
__construct
(
$config
);
// Properties
$this
->
config
=
$config
;
$this
->
radioselectinput
=
new
RadioSelectInputWidget
(
$config
[
'radioselectinput'
]
);
$this
->
textinput
=
new
TextInputWidget
(
$config
[
'textinput'
]
);
$this
->
label
=
new
LabelWidget
(
[
'label'
=>
wfMessage
(
'pagesize'
)->
text
()
]
);
// Initialization
$this
->
radioselectinput
->
setValue
(
$config
[
'selectMin'
]
?
'min'
:
'max'
);
$this
->
addClasses
(
[
'mw-widget-sizeFilterWidget'
]
)
->
appendContent
(
$this
->
radioselectinput
,
$this
->
textinput
,
$this
->
label
);
}
/** @inheritDoc */
protected
function
getJavaScriptClassName
()
{
return
'mw.widgets.SizeFilterWidget'
;
}
/** @inheritDoc */
public
function
getConfig
(
&
$config
)
{
$config
[
'textinput'
]
=
$this
->
config
[
'textinput'
];
$config
[
'radioselectinput'
]
=
$this
->
config
[
'radioselectinput'
];
$config
[
'selectMin'
]
=
$this
->
config
[
'selectMin'
];
return
parent
::
getConfig
(
$config
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 15:15 (15 h, 13 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0d/c0/f4a3c2bb3305b9e24c2591c79da8
Default Alt Text
SizeFilterWidget.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment