Passed
Push — master ( 492dcf...32ce96 )
by Julito
09:05
created

ToolResourceRightAdmin::configureFormFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nop 1
dl 0
loc 13
rs 9.9332
c 0
b 0
f 0
nc 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Admin;
5
6
use Chamilo\CoreBundle\Entity\ToolResourceRight;
7
use Sonata\AdminBundle\Admin\AbstractAdmin;
8
use Sonata\AdminBundle\Datagrid\DatagridMapper;
9
use Sonata\AdminBundle\Datagrid\ListMapper;
10
use Sonata\AdminBundle\Form\FormMapper;
11
12
/**
13
 * Class ToolResourceRightAdmin.
14
 *
15
 * @package Chamilo\CoreBundle\Admin
16
 */
17
class ToolResourceRightAdmin extends AbstractAdmin
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    protected function configureFormFields(FormMapper $formMapper)
23
    {
24
        $formMapper
25
            ->add('tool')
26
            ->add(
27
                'role',
28
                'choice',
29
                ['choices' => ToolResourceRight::getDefaultRoles()]
30
            )
31
            ->add(
32
                'mask',
33
                'choice',
34
                ['choices' => ToolResourceRight::getMaskList()]
35
            )
36
        ;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
43
    {
44
        $datagridMapper
45
            ->add('role')
46
        ;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected function configureListFields(ListMapper $listMapper)
53
    {
54
        $listMapper
55
            ->addIdentifier('id')
56
            ->addIdentifier('role')
57
            ->addIdentifier('mask')
58
        ;
59
    }
60
}
61