|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\CMSBundle\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Admin\Admin; |
|
6
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
|
7
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
|
8
|
|
|
|
|
9
|
|
|
class BaseNodeEntityAdmin extends Admin |
|
10
|
|
|
{ |
|
11
|
|
|
protected function configureFormFields(FormMapper $formMapper) |
|
12
|
|
|
{ |
|
13
|
|
|
$container = $this->getConfigurationPool()->getContainer(); |
|
14
|
|
|
|
|
15
|
|
|
$realLocales = []; |
|
16
|
|
|
$locales = $container->getParameter('lunetics_locale.allowed_locales'); |
|
17
|
|
|
foreach ($locales as $val) { |
|
18
|
|
|
$realLocales[$val] = $val; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
$formMapper |
|
22
|
|
|
->add('title', null, [ |
|
23
|
|
|
'label' => 'Titre', |
|
24
|
|
|
'required' => true, |
|
25
|
|
|
]) |
|
26
|
|
|
->add('content', 'ckeditor', [ |
|
27
|
|
|
'label' => 'Contenu', |
|
28
|
|
|
'required' => true, |
|
29
|
|
|
'config_name' => 'admin', |
|
30
|
|
|
]) |
|
31
|
|
|
->add('locale', 'choice', [ |
|
32
|
|
|
'label' => 'Langue du contenu', |
|
33
|
|
|
'choices' => $realLocales, |
|
34
|
|
|
'required' => true, |
|
35
|
|
|
]) |
|
36
|
|
|
->add('published', 'checkbox', [ |
|
37
|
|
|
'label' => 'Publié', |
|
38
|
|
|
'required' => false, |
|
39
|
|
|
]); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
protected function configureListFields(ListMapper $listMapper) |
|
43
|
|
|
{ |
|
44
|
|
|
$listMapper |
|
45
|
|
|
->add('id', null, [ |
|
46
|
|
|
'label' => 'ID', |
|
47
|
|
|
]) |
|
48
|
|
|
->add('title', null, [ |
|
49
|
|
|
'label' => 'Titre', |
|
50
|
|
|
]) |
|
51
|
|
|
->add('published', null, [ |
|
52
|
|
|
'label' => 'Publié', |
|
53
|
|
|
]) |
|
54
|
|
|
->add('dateCreated', null, [ |
|
55
|
|
|
'label' => 'Crée', |
|
56
|
|
|
]) |
|
57
|
|
|
->add('dateUpdated', null, [ |
|
58
|
|
|
'label' => 'Mis à jour', |
|
59
|
|
|
]) |
|
60
|
|
|
->add('_action', 'actions'); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|