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

NameableExtension::configureFormFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 10
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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