TextAssetType::getParent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace NVBooster\PHPCRAssetsBundle\Form;
3
4
use Symfony\Component\Form\AbstractType;
5
use Symfony\Component\Form\FormView;
6
use Symfony\Component\Form\FormInterface;
7
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
8
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
9
10
/**
11
 * @author nvb
12
 *
13
 */
14
class TextAssetType extends AbstractType
15
{
16
    /**
17
     * @var array
18
     */
19
    protected $parameters;
20
    
21
    /**
22
     * @param array $defaultsParameters
23
     */
24
    public function __construct($defaultsParameters = array())
25
    {
26
        $this->parameters = $defaultsParameters;
27
    }
28
    
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function buildView(FormView $view, FormInterface $form, array $options)
33
    {
34
        $view->vars['codemirror'] = array_merge($this->parameters, $options['codemirror']);
35
    }
36
    
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function setDefaultOptions(OptionsResolverInterface $resolver)
41
    {
42
        $resolver->setDefaults(
43
            array(
44
                'codemirror' => $this->parameters
45
            )
46
        );
47
    }
48
    
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getParent()
53
    {
54
        return TextareaType::class;
55
    }
56
    
57
    /**
58
     * {@inheritDoc}
59
     * @see \Symfony\Component\Form\FormTypeInterface::getName()
60
     */
61
    public function getName()
62
    {
63
        return 'textasset';
64
    }
65
}