Completed
Pull Request — master (#343)
by Leny
09:31
created

OffsetButtonExtension::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Victoire\Bundle\FormBundle\Form\Extension;
4
5
/*
6
 * This file is part of the MopaBootstrapBundle.
7
 *
8
 * (c) Philipp A. Mohrenweiser <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
use Symfony\Component\Form\AbstractTypeExtension;
15
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
16
use Symfony\Component\Form\FormInterface;
17
use Symfony\Component\Form\FormView;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
/**
21
 * Extension for Offsetting a button.
22
 *
23
 * @author peshi <[email protected]>
24
 */
25
class OffsetButtonExtension extends AbstractTypeExtension
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getExtendedType()
31
    {
32
        return ButtonType::class;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function configureOptions(OptionsResolver $resolver)
39
    {
40
        $resolver->setDefaults(
41
            [
42
                'vic_button_offset' => null,
43
            ]
44
        );
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function buildView(FormView $view, FormInterface $form, array $options)
51
    {
52
        $view->vars['vic_button_offset'] = $options['vic_button_offset'];
53
    }
54
}
55