1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Smart\ContentBundle\Admin\Extension; |
4
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Admin\AbstractAdminExtension; |
6
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
7
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
8
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
9
|
|
|
use Sonata\AdminBundle\Show\ShowMapper; |
10
|
|
|
use Vich\UploaderBundle\Form\Type\VichImageType; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Nicolas Bastien <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class ContentExtension extends AbstractAdminExtension |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
*/ |
20
|
|
|
public function configureDatagridFilters(DatagridMapper $datagrid) |
21
|
|
|
{ |
22
|
|
|
$datagrid |
23
|
|
|
->add('title', null, [ |
24
|
|
|
'label' => 'form.label_title', |
25
|
|
|
'show_filter' => true, |
26
|
|
|
]) |
27
|
|
|
->add('enabled', null, [ |
28
|
|
|
'label' => 'form.label_enabled', |
29
|
|
|
'show_filter' => true, |
30
|
|
|
]) |
31
|
|
|
; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* {@inheritdoc} |
36
|
|
|
*/ |
37
|
|
|
public function configureListFields(ListMapper $list) |
38
|
|
|
{ |
39
|
|
|
|
40
|
|
|
$list |
41
|
|
|
->add('title', null, ['label' => 'form.label_title']) |
42
|
|
|
; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* {@inheritdoc} |
47
|
|
|
*/ |
48
|
|
|
public function configureFormFields(FormMapper $form) |
49
|
|
|
{ |
50
|
|
|
$form |
51
|
|
|
->tab('tab.label_content') |
52
|
|
|
->with('fieldset.label_general', ['class' => 'col-md-8']) |
53
|
|
|
->add('title') |
54
|
|
|
->add('description', null, [ |
55
|
|
|
'attr' => [ |
56
|
|
|
'rows' => 5 |
57
|
|
|
] |
58
|
|
|
]) |
59
|
|
|
->add('content', null, [ |
60
|
|
|
'attr' => [ |
61
|
|
|
'rows' => 25, |
62
|
|
|
'class' => 'wysiwyg' |
63
|
|
|
] |
64
|
|
|
]) |
65
|
|
|
->end() |
66
|
|
|
->end() |
67
|
|
|
; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* {@inheritDoc} |
72
|
|
|
*/ |
73
|
|
|
public function configureShowFields(ShowMapper $show) |
74
|
|
|
{ |
75
|
|
|
$show |
76
|
|
|
->tab('tab.label_content') |
77
|
|
|
->with('fieldset.label_general', ['class' => 'col-md-8']) |
78
|
|
|
->add('title', null, ['label' => 'form.label_title']) |
79
|
|
|
->add('description', null, ['label' => 'form.label_description']) |
80
|
|
|
->add('content', null, [ |
81
|
|
|
'label' => 'form.label_content', |
82
|
|
|
'safe' => true |
83
|
|
|
]) |
84
|
|
|
->end() |
85
|
|
|
->end() |
86
|
|
|
; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|