1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* (c) FSi sp. z o.o. <[email protected]> |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace FSi\FixturesBundle\DataGrid; |
10
|
|
|
|
11
|
|
|
use FSi\Component\DataGrid\DataGridInterface; |
12
|
|
|
|
13
|
|
|
class NewsDataGridBuilder |
14
|
|
|
{ |
15
|
|
|
public static function buildNewsDataGrid(DataGridInterface $datagrid) |
16
|
|
|
{ |
17
|
|
|
$datagrid->addColumn('title', 'text', [ |
18
|
|
|
'label' => 'admin.news.list.title', |
19
|
|
|
'field_mapping' => ['title', 'subtitle'], |
20
|
|
|
'value_glue' => '<br/>', |
21
|
|
|
'editable' => true |
22
|
|
|
]); |
23
|
|
|
|
24
|
|
|
$datagrid->addColumn('date', 'datetime', [ |
25
|
|
|
'label' => 'admin.news.list.date', |
26
|
|
|
'datetime_format' => 'Y-m-d', |
27
|
|
|
'editable' => true, |
28
|
|
|
'form_type' => ['date' => 'date'], |
29
|
|
|
'form_options' => [ |
30
|
|
|
'date' => ['widget' => 'single_text'] |
31
|
|
|
] |
32
|
|
|
]); |
33
|
|
|
|
34
|
|
|
$datagrid->addColumn('created_at', 'datetime', [ |
35
|
|
|
'label' => 'admin.news.list.created_at' |
36
|
|
|
]); |
37
|
|
|
|
38
|
|
|
$datagrid->addColumn('visible', 'boolean', [ |
39
|
|
|
'label' => 'admin.news.list.visible' |
40
|
|
|
]); |
41
|
|
|
|
42
|
|
|
$datagrid->addColumn('creator_email', 'text', [ |
43
|
|
|
'label' => 'admin.news.list.creator_email' |
44
|
|
|
]); |
45
|
|
|
|
46
|
|
|
$datagrid->addColumn('photo', 'fsi_image', [ |
47
|
|
|
'label' => 'admin.news.list.photo', |
48
|
|
|
'width' => 100 |
49
|
|
|
]); |
50
|
|
|
|
51
|
|
|
return $datagrid; |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|