MediaWiki
1.34.0
DateTimeInputWidget.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Widget
;
4
5
use OOUI\Tag;
6
13
class
DateTimeInputWidget
extends
\OOUI\InputWidget {
14
15
protected
$type
=
null
;
16
protected
$min
=
null
;
17
protected
$max
=
null
;
18
protected
$clearable
=
null
;
19
27
public
function
__construct
( array
$config
= [] ) {
28
// We need $this->type set before calling the parent constructor
29
if
( isset(
$config
[
'type'
] ) ) {
30
$this->type =
$config
[
'type'
];
31
}
else
{
32
throw
new \InvalidArgumentException(
'$config[\'type\'] must be specified'
);
33
}
34
35
parent::__construct(
$config
);
36
37
// Properties, which are ignored in PHP and just shipped back to JS
38
if
( isset(
$config
[
'min'
] ) ) {
39
$this->min =
$config
[
'min'
];
40
}
41
if
( isset(
$config
[
'max'
] ) ) {
42
$this->max =
$config
[
'max'
];
43
}
44
if
( isset(
$config
[
'clearable'
] ) ) {
45
$this->clearable =
$config
[
'clearable'
];
46
}
47
48
// Initialization
49
$this->addClasses( [
'mw-widgets-datetime-dateTimeInputWidget'
] );
50
}
51
52
protected
function
getJavaScriptClassName
() {
53
return
'mw.widgets.datetime.DateTimeInputWidget'
;
54
}
55
56
public
function
getConfig
( &
$config
) {
57
$config
[
'type'
] =
$this->type
;
58
if
( $this->min !==
null
) {
59
$config
[
'min'
] =
$this->min
;
60
}
61
if
( $this->max !==
null
) {
62
$config
[
'max'
] =
$this->max
;
63
}
64
if
( $this->clearable !==
null
) {
65
$config
[
'clearable'
] =
$this->clearable
;
66
}
67
return
parent::getConfig(
$config
);
68
}
69
70
protected
function
getInputElement
(
$config
) {
71
return
(
new
Tag(
'input'
) )->setAttributes( [
'type'
=> $this->type ] );
72
}
73
}
MediaWiki\Widget\DateTimeInputWidget\$min
$min
Definition:
DateTimeInputWidget.php:16
MediaWiki\Widget\DateTimeInputWidget\getInputElement
getInputElement( $config)
Definition:
DateTimeInputWidget.php:70
MediaWiki\Widget\DateTimeInputWidget\$type
$type
Definition:
DateTimeInputWidget.php:15
MediaWiki\Widget\DateTimeInputWidget\$clearable
$clearable
Definition:
DateTimeInputWidget.php:18
MediaWiki\Widget\DateTimeInputWidget\__construct
__construct(array $config=[])
Definition:
DateTimeInputWidget.php:27
MediaWiki\Widget\DateTimeInputWidget\getConfig
getConfig(&$config)
Definition:
DateTimeInputWidget.php:56
MediaWiki\Widget\DateTimeInputWidget\$max
$max
Definition:
DateTimeInputWidget.php:17
MediaWiki\Widget
Definition:
CheckMatrixWidget.php:3
MediaWiki\Widget\DateTimeInputWidget\getJavaScriptClassName
getJavaScriptClassName()
Definition:
DateTimeInputWidget.php:52
MediaWiki\$config
Config $config
Definition:
MediaWiki.php:43
MediaWiki\Widget\DateTimeInputWidget
Date-time input widget.
Definition:
DateTimeInputWidget.php:13
includes
widget
DateTimeInputWidget.php
Generated on Thu Dec 19 2019 14:55:06 for MediaWiki by
1.8.16