Passed
Push — master ( df5a4b...5938e5 )
by Rodrigo
02:10 queued 40s
created

DateColumn::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 13
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace dynamikaweb\grid;
4
5
use Yii;
6
use yii\helpers\Html;
7
8
class DateColumn extends \yii\grid\DataColumn
9
{
10
    public $format = 'short';
11
    public $options = [];
12
    public $filterOptions = [];
13
14
    public function init ()
15
    {
16
        $this->format = ['date', $this->format];
17
        $this->filter = \yii\jui\DatePicker::widget([
18
            'model'=> $this->grid->filterModel,
19
            'attribute' => $this->attribute,
20
            'language' => Yii::$app->language,
21
            'dateFormat' => 'dd/MM/yyyy',
22
            'options' => array_merge(['class' => 'form-control'], $this->filterOptions)
23
        ]);
24
        $this->options = array_merge(['width' => '150px'], $this->options);
25
26
        parent::init();
27
    }
28
}
29