Module::buildForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 44
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 32
c 2
b 0
f 1
nc 1
nop 2
dl 0
loc 44
rs 9.408
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
7
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
9
use Symfony\Component\Form\Extension\Core\Type\TextType;
10
use Symfony\Component\Form\FormBuilderInterface;
11
use Symfony\Component\OptionsResolver\OptionsResolver;
12
13
class Module extends AbstractType
14
{
15
    /**
16
     * @param FormBuilderInterface $builder
17
     * @param array $options
18
     */
19
	public function buildForm(FormBuilderInterface $builder, array $options)
20
	{
21
		$builder
22
			->add("title", TextType::class, [
23
				"label" => "Name",
24
				"required" => true
25
			])
26
			->add("packageName", TextType::class, [
27
				"label" => "Package name",
28
				"required" => true
29
			])
30
            ->add("titleTag", TextType::class, [
31
                "label" => "Title tag",
32
                "required" => true
33
            ])
34
            ->add("descriptionTag", TextareaType::class, [
35
                "label" => "Description tag",
36
                "required" => true,
37
            ])
38
            ->add("url", TextType::class, [
39
                "label" => "Url",
40
                "required" => true
41
            ])
42
            ->add("urlAdmin", TextType::class, [
43
                "label" => "Admin url",
44
                "required" => true
45
            ])
46
			->add("active", CheckboxType::class, [
47
				"label" => "Enable module",
48
				"attr" => [
49
					"class" => "ribs-checkbox switched cxs-2 no-pl"
50
				],
51
				"required" => false
52
			])
53
            ->add("displayed", CheckboxType::class, [
54
                "label" => "Display module in navigation",
55
                "attr" => [
56
                    "class" => "ribs-checkbox switched cxs-2 no-pl"
57
                ],
58
                "required" => false
59
            ])
60
            ->add('submit', SubmitType::class, [
61
                'label' => 'Validate',
62
                'attr' => []
63
            ]);
64
	}
65
66
    /**
67
     * @param OptionsResolver $resolver
68
     */
69
	public function configureOptions(OptionsResolver $resolver)
70
	{
71
		$resolver->setDefaults([
72
			"data_class" => \PiouPiou\RibsAdminBundle\Entity\Module::class,
73
		]);
74
	}
75
}
76