1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\CMSBundle\Admin; |
4
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
6
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
7
|
|
|
use Sonata\AdminBundle\Route\RouteCollection; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @author Benjamin HUBERT <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class BaseBlockEntityAdmin extends BaseAdmin |
13
|
|
|
{ |
14
|
|
|
protected $baseRouteName = 'alpixel_admin_cms_block'; |
15
|
|
|
protected $baseRoutePattern = 'block'; |
16
|
|
|
protected $datagridValues = [ |
17
|
|
|
'_page' => 1, |
18
|
|
|
'_sort_order' => 'DESC', |
19
|
|
|
'_sort_by' => 'dateUpdated', |
20
|
|
|
]; |
21
|
|
|
|
22
|
|
|
protected function configureRoutes(RouteCollection $collection) |
23
|
|
|
{ |
24
|
|
|
$collection->clearExcept(['list', 'delete', 'edit']); |
25
|
|
|
$collection->add('editContent', $this->getRouterIdParameter().'/edit/block'); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
protected function configureFormFields(FormMapper $formMapper) |
29
|
|
|
{ |
30
|
|
|
$formMapper |
31
|
|
|
->add('content', 'ckeditor', [ |
32
|
|
|
'label' => 'Contenu', |
33
|
|
|
'required' => true, |
34
|
|
|
'config_name' => 'admin', |
35
|
|
|
]) |
36
|
|
|
->end(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper |
41
|
|
|
* |
42
|
|
|
* @return void |
43
|
|
|
*/ |
44
|
|
|
protected function configureListFields(ListMapper $listMapper) |
45
|
|
|
{ |
46
|
|
|
$listMapper |
47
|
|
|
->add('id') |
48
|
|
|
->add('locale', null, [ |
49
|
|
|
'label' => 'Langue', |
50
|
|
|
]) |
51
|
|
|
->add('name', null, [ |
52
|
|
|
'label' => 'Nom', |
53
|
|
|
]) |
54
|
|
|
->add('dateCreated', null, [ |
55
|
|
|
'label' => 'Date de création', |
56
|
|
|
]) |
57
|
|
|
->add('dateUpdated', null, [ |
58
|
|
|
'label' => 'Date d\'édition', |
59
|
|
|
]) |
60
|
|
|
->add('_action', 'actions', [ |
61
|
|
|
'actions' => [ |
62
|
|
|
'editContent' => ['template' => 'AlpixelCMSBundle:admin:fields/list__action_edit.html.twig'], |
63
|
|
|
'delete' => [], |
64
|
|
|
], |
65
|
|
|
]); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|