Completed
Push — master ( 57b021...d38ccd )
by Nicolas
29:22 queued 27:52
created

NameableExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 5
dl 0
loc 53
ccs 0
cts 35
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A configureDatagridFilters() 0 9 1
A configureListFields() 0 6 1
A configureFormFields() 0 10 1
A configureShowFields() 0 10 1
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
11
/**
12
 * Nicolas Bastien <[email protected]>
13
 */
14
class NameableExtension extends AbstractAdminExtension
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function configureDatagridFilters(DatagridMapper $datagrid)
20
    {
21
        $datagrid
22
            ->add('name', null, [
23
                'label' => 'form.label_name',
24
                'show_filter' => true,
25
            ])
26
        ;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function configureListFields(ListMapper $list)
33
    {
34
        $list
35
            ->addIdentifier('name', null, ['label' => 'form.label_name'])
36
        ;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function configureFormFields(FormMapper $form)
43
    {
44
        $form
45
            ->tab('tab.label_content')
46
                ->with('fieldset.label_general')
47
                    ->add('name')
48
                ->end()
49
            ->end()
50
        ;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public function configureShowFields(ShowMapper $show)
57
    {
58
        $show
59
            ->tab('tab.label_content')
60
                ->with('fieldset.label_general')
61
                    ->add('name', null, ['label' => 'form.label_name'])
62
                ->end()
63
            ->end()
64
        ;
65
    }
66
}
67