AddressGridView   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 24 1
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\grid;
12
13
use hipanel\grid\XEditableColumn;
14
use hipanel\modules\hosting\menus\AddressActionsMenu;
15
use hiqdev\yii2\menus\grid\MenuColumn;
16
use Yii;
17
use yii\helpers\Html;
18
19
class AddressGridView extends PrefixGridView
20
{
21
    public function columns()
22
    {
23
        return array_merge(parent::columns(), [
24
            'ip' => [
25
                'format' => 'html',
26
                'value' => static function ($address) {
27
                    return Html::a($address->ip, ['@address/view', 'id' => $address->id], ['class' => 'text-bold']);
28
                },
29
            ],
30
            'note' => [
31
                'class' => XEditableColumn::class,
32
                'pluginOptions' => [
33
                    'url' => '@address/set-note',
34
                ],
35
                'filter' => true,
36
                'popover' => Yii::t('hipanel', 'Make any notes for your convenience'),
37
            ],
38
            'actions' => [
39
                'class' => MenuColumn::class,
40
                'contentOptions' => ['style' => 'width: 1%; white-space:nowrap;'],
41
                'menuClass' => AddressActionsMenu::class,
42
            ],
43
        ]);
44
    }
45
}
46