Completed
Pull Request — master (#33)
by Benjamin
02:22
created

AdminBlock::configureListFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 23
Ratio 100 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
c 5
b 1
f 0
dl 23
loc 23
rs 9.0856
cc 1
eloc 15
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 BaseAdmin
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->add('editContent', $this->getRouterIdParameter().'/edit/block');
22
    }
23
24
    /**
25
     * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
26
     *
27
     * @return void
28
     */
29 View Code Duplication
    protected function configureListFields(ListMapper $listMapper)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
                    'editContent' => ['template' => 'AlpixelCMSBundle:admin:fields/list__action_edit.html.twig'],
48
                    'delete'      => [],
49
                ],
50
            ]);
51
    }
52
}