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
|
|
|
|