Completed
Push — master ( 1212b8...011c4b )
by Paweł
29:44 queued 19:42
created

SelectAttributeConfigurationType::buildForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\AttributeBundle\Form\Type\AttributeType\Configuration;
13
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
16
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
17
use Symfony\Component\Form\Extension\Core\Type\NumberType;
18
use Symfony\Component\Form\Extension\Core\Type\TextType;
19
use Symfony\Component\Form\FormBuilderInterface;
20
21
/**
22
 * @author Laurent Paganin-Gioanni <[email protected]>
23
 */
24
class SelectAttributeConfigurationType extends AbstractType
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function buildForm(FormBuilderInterface $builder, array $options)
30
    {
31
        $builder
32
            ->add('choices', CollectionType::class, [
33
                'entry_type' => TextType::class,
34
                'label' => 'sylius.form.attribute_type_configuration.select.values',
35
                'allow_add' => true,
36
                'allow_delete' => true,
37
            ])
38
            ->add('multiple', CheckboxType::class, [
39
                'label' => 'sylius.form.attribute_type_configuration.select.multiple',
40
            ])
41
            ->add('min', NumberType::class, [
42
                'label' => 'sylius.form.attribute_type_configuration.select.min'
43
            ])
44
            ->add('max', NumberType::class, [
45
                'label' => 'sylius.form.attribute_type_configuration.select.max'
46
            ])
47
        ;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getBlockPrefix()
54
    {
55
        return 'sylius_attribute_type_configuration_select';
56
    }
57
}
58