-
Notifications
You must be signed in to change notification settings - Fork 0
/
DatePicker.php
27 lines (23 loc) · 897 Bytes
/
DatePicker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace makroxyz\materializecss;
use yii\widgets\InputWidget;
class DatePicker extends InputWidget
{
use MaterializeWidgetTrait;
public function run()
{
Html::addCssClass($this->options, 'datepicker');
$this->registerPlugin('pickadate');
// if (!isset($this->clientOptions['container'])) {
// $this->clientOptions['container'] = 'body';
// }
// $this->clientOptions['editable'] = false;
if ($this->hasModel()) {
$this->options['data-value'] = isset($this->value) ? $this->value : Html::getAttributeValue($this->model, $this->attribute);
return Html::activeInput('text', $this->model, $this->attribute, $this->options);
} else {
$this->options['data-value'] = $this->value;
return Html::input('text', $this->name, $this->value, $this->options);
}
}
}