MediaFocalPointType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace MediaMonks\SonataMediaBundle\Form\Type;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\TextType;
7
use Symfony\Component\Form\FormInterface;
8
use Symfony\Component\Form\FormView;
9
use Symfony\Component\OptionsResolver\OptionsResolver;
10
11
class MediaFocalPointType extends AbstractType
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 7
    public function configureOptions(OptionsResolver $resolver)
17
    {
18 7
        $resolver->setDefaults(
19
            [
20 7
                'media' => null,
21
                'template' => 'MediaMonksMediaBundle:Form/Type:media_focal_point.html.twig',
22
            ]
23
        );
24 7
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 7
    public function buildView(FormView $view, FormInterface $form, array $options)
30
    {
31 7
        $view->vars['template'] = $options['template'];
32 7
    }
33
34
    /**
35
     * @param FormView $view
36
     * @param FormInterface $form
37
     * @param array $options
38
     */
39 7
    public function finishView(FormView $view, FormInterface $form, array $options)
40
    {
41 7
        $view->vars['media'] = $options['media'];
42 7
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 7
    public function getBlockPrefix()
48
    {
49 7
        return 'media_focal_point';
50
    }
51
52
    /**
53
     * @return string
54
     */
55 7
    public function getParent()
56
    {
57 7
        return TextType::class;
58
    }
59
}
60