MediaAdmin::configureFormFields()   A
last analyzed

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 9
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;
4
5
use Smart\SonataBundle\Admin\AbstractAdmin;
6
use Sonata\AdminBundle\Datagrid\ListMapper;
7
use Sonata\AdminBundle\Form\FormMapper;
8
use Sonata\AdminBundle\Show\ShowMapper;
9
10
/**
11
 * Nicolas Bastien <[email protected]>
12
 */
13
class MediaAdmin extends AbstractAdmin
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function configureListFields(ListMapper $list)
19
    {
20
        $list
21
            ->addIdentifier('id')
22
        ;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function configureFormFields(FormMapper $form)
29
    {
30
        //Todo see if we can fix admin display with extension priority
31
        $form
32
            ->tab('tab.label_content')
33
                ->with('fieldset.label_general')
34
                ->end()
35
            ->end()
36
        ;
37
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    protected function configureShowFields(ShowMapper $show)
43
    {
44
        $show
45
            ->tab('tab.label_content')
46
                ->with('fieldset.label_general')->end()
47
                ->with('fieldset.label_parameters')->end()
48
                ->with('fieldset.label_preview')
49
                    ->add('formats', null, [
50
                        'label' => 'form.label_formats',
51
                        'mapped' => false,
52
                        'template'  => '@SmartContent/admin/show_format.html.twig',
53
                        'formats' => [
54
                            'smart_content_list_thumb',
55
                            'smart_content_show_thumb'
56
                        ]// Todo handle this with configuration https://github.com/smartbooster/content-bundle/issues/7
57
                    ])
58
                ->end()
59
            ->end()
60
        ;
61
    }
62
}
63