Completed
Push — master ( d67f41...79042b )
by Adam
07:27
created

NewsDataGrid::configureColumns()   B

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 30
Code Lines 19

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 19
nc 1
nop 1
1
<?php
2
/*
3
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\CmsBundle\DataGrid;
14
15
use WellCommerce\Bundle\CoreBundle\DataGrid\AbstractDataGrid;
16
use WellCommerce\Component\DataGrid\Column\Column;
17
use WellCommerce\Component\DataGrid\Column\ColumnCollection;
18
use WellCommerce\Component\DataGrid\Column\Options\Appearance;
19
use WellCommerce\Component\DataGrid\Column\Options\Filter;
20
use WellCommerce\Component\DataGrid\Column\Options\Sorting;
21
22
/**
23
 * Class NewsDataGrid
24
 *
25
 * @author  Adam Piotrowski <[email protected]>
26
 */
27
class NewsDataGrid extends AbstractDataGrid
28
{
29
    public function configureColumns(ColumnCollection $collection)
30
    {
31
        $collection->add(new Column([
32
            'id'         => 'id',
33
            'caption'    => 'common.label.id',
34
            'sorting'    => new Sorting([
35
                'default_order' => Sorting::SORT_DIR_DESC,
36
            ]),
37
            'appearance' => new Appearance([
38
                'width'   => 90,
39
                'visible' => false,
40
            ]),
41
            'filter'     => new Filter([
42
                'type' => Filter::FILTER_BETWEEN,
43
            ]),
44
        ]));
45
        
46
        $collection->add(new Column([
47
            'id'      => 'topic',
48
            'caption' => 'news.label.topic',
49
        ]));
50
        
51
        $collection->add(new Column([
52
            'id'      => 'category',
53
            'caption' => 'news.label.category',
54
            'filter'  => new Filter([
55
                'type' => Filter::FILTER_INPUT,
56
            ]),
57
        ]));
58
    }
59
    
60
    public function getIdentifier(): string
61
    {
62
        return 'news';
63
    }
64
}
65