Completed
Push — master ( a57c3d...fa0598 )
by Antonio
02:20
created

ColumnTrait   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 1
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 37
ccs 0
cts 16
cp 0
rs 10
c 1
b 1
f 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-grid-view-library project.
5
 * (c) 2amigOS! <http://2amigos.us/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace dosamigos\grid\traits;
11
12
use dosamigos\grid\GridView;
13
14
/**
15
 * @property GridView $grid the grid view object that owns this column.
16
 */
17
trait ColumnTrait
18
{
19
    /**
20
     * @var bool
21
     */
22
    public $rowSpanNoFilterHeaders = false;
23
24
    /**
25
     * Renders the header cell.
26
     *
27
     * @return string
28
     */
29
    public function renderHeaderCell()
30
    {
31
        if (null !== $this->grid->filterModel && false === $this->filter && $this->rowSpanNoFilterHeaders = true &&
32
                $this->grid->filterPosition === GridView::FILTER_POS_BODY) {
33
            $this->headerOptions['rowspan'] = 2;
34
        }
35
36
        return parent::renderHeaderCell();
37
    }
38
39
    /**
40
     * Renders the filter cell.
41
     *
42
     * @return string
43
     */
44
    public function renderFilterCell()
45
    {
46
        if (null !== $this->grid->filterModel && false === $this->filter && $this->rowSpanNoFilterHeaders = true &&
47
                $this->grid->filterPosition === GridView::FILTER_POS_BODY) {
48
            return null;
49
        }
50
51
        return parent::renderFilterCell();
52
    }
53
}
54