1
|
|
|
<?php |
2
|
|
|
namespace ProjetNormandie\ComptaBundle\Admin; |
3
|
|
|
|
4
|
|
|
use Sonata\AdminBundle\Admin\AbstractAdmin; |
5
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
6
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
7
|
|
|
use Sonata\AdminBundle\Route\RouteCollection; |
8
|
|
|
use Sonata\AdminBundle\Route\RouteCollectionInterface; |
9
|
|
|
use Sonata\AdminBundle\Show\ShowMapper; |
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
11
|
|
|
|
12
|
|
|
class SourceAdmin extends AbstractAdmin |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @param RouteCollection $collection |
16
|
|
|
*/ |
17
|
|
|
protected function configureRoutes(RouteCollectionInterface $collection): void |
18
|
|
|
{ |
19
|
|
|
$collection |
20
|
|
|
->remove('show') |
21
|
|
|
->remove('export') |
22
|
|
|
->remove('delete'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param FormMapper $form |
27
|
|
|
*/ |
28
|
|
|
protected function configureFormFields(FormMapper $form): void |
29
|
|
|
{ |
30
|
|
|
$form |
31
|
|
|
->add('label', TextType::class, [ |
32
|
|
|
'label' => 'label.label', |
33
|
|
|
'required' => true, |
34
|
|
|
]); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param ListMapper $list |
39
|
|
|
*/ |
40
|
|
|
protected function configureListFields(ListMapper $list): void |
41
|
|
|
{ |
42
|
|
|
$list |
43
|
|
|
->addIdentifier('id', null, ['label' => 'label.id']) |
44
|
|
|
->add('label', null, ['label' => 'label.label']) |
45
|
|
|
->add('_action', 'actions', [ |
46
|
|
|
'actions' => [ |
47
|
|
|
'edit' => [], |
48
|
|
|
] |
49
|
|
|
]); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param ShowMapper $show |
54
|
|
|
*/ |
55
|
|
|
protected function configureShowFields(ShowMapper $show): void |
56
|
|
|
{ |
57
|
|
|
$show |
58
|
|
|
->add('id', null, ['label' => 'label.id']) |
59
|
|
|
->add('label', null, ['label' => 'label.label']); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|