AdminBlock::configureRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Admin;
4
5
use Sonata\AdminBundle\Datagrid\ListMapper;
6
use Sonata\AdminBundle\Route\RouteCollection;
7
8
class AdminBlock extends BaseBlockEntityAdmin
9
{
10
    protected $baseRouteName = 'alpixel_admin_cms_block';
11
    protected $baseRoutePattern = 'block';
12
13
    protected $datagridValues = [
14
        '_page'       => 1,
15
        '_sort_order' => 'DESC',
16
        '_sort_by'    => 'dateUpdated',
17
    ];
18
19
    protected function configureRoutes(RouteCollection $collection)
20
    {
21
        $collection->clearExcept(['list', 'edit']);
22
    }
23
24
    /**
25
     * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
26
     *
27
     * @return void
28
     */
29
    protected function configureListFields(ListMapper $listMapper)
30
    {
31
        $listMapper
32
            ->add('id')
33
            ->add('locale', null, [
34
                'label' => 'Langue',
35
            ])
36
            ->add('name', null, [
37
                'label' => 'Nom',
38
            ])
39
            ->add('dateCreated', null, [
40
                'label' => 'Date de création',
41
            ])
42
            ->add('dateUpdated', null, [
43
                'label' => 'Date d\'édition',
44
            ])
45
            ->add('_action', 'actions', [
46
                'actions' => [
47
                    'edit' => ['template' => 'AlpixelCMSBundle:admin:fields/list__block_action_edit.html.twig'],
48
                ],
49
            ]);
50
    }
51
}
52