Completed
Push — master ( 3c8880...e2c218 )
by Dmitry
06:42 queued 02:46
created

EmailColumn   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 18 3
1
<?php
2
3
/*
4
 * HiPanel core package
5
 *
6
 * @link      https://hipanel.com/
7
 * @package   hipanel-core
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hipanel\grid;
13
14
use hipanel\widgets\Select2;
15
use yii\helpers\Html;
16
use yii\helpers\Url;
17
18
class EmailColumn extends DataColumn
19
{
20
    public function init()
21
    {
22
        parent::init();
23
        \Yii::configure($this, [
24
            'attribute'             => 'email',
25
            'label'                 => \Yii::t('app', 'Email'),
26
            'format'                => 'html',
27
            'value'                 => function ($model) {
28
                return Html::a($model->client ?: $model->login, ['/client/contact/view', 'id' => $model->client ? $model->client_id : $model->id]);
29
            },
30
            'filterInputOptions'    => ['email' => 'email'],
31
            'filter'                => Select2::widget([
32
                'attribute' => 'email',
33
                'model'     => $this->grid->filterModel,
34
                'url'       => Url::toRoute(['/client/contact/email-list']),
35
            ]),
36
        ]);
37
    }
38
}
39