Completed
Push — master ( b453a3...b1e9d6 )
by Ruud
40:05 queued 27:14
created

HeaderPagePartAdminType::buildForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Kunstmaan\PagePartBundle\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
7
use Symfony\Component\Form\Extension\Core\Type\TextType;
8
use Symfony\Component\Form\FormBuilderInterface;
9
use Symfony\Component\OptionsResolver\OptionsResolver;
10
11
/**
12
 * HeaderPagePartAdminType
13
 */
14
class HeaderPagePartAdminType extends AbstractType
15
{
16
    /**
17
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
18
     * @param array                                        $options
19
     */
20 1
    public function buildForm(FormBuilderInterface $builder, array $options)
21
    {
22 1
        $builder->add(
23 1
          'niv',
24 1
          ChoiceType::class,
25
          array(
26 1
            'label' => 'pagepart.header.type',
27
            'choices' => array('Header 1' => '1', 'Header 2' => '2', 'Header 3' => '3', 'Header 4' => '4', 'Header 5' => '5', 'Header 6' => '6'),
28
            'required' => true,
29
          )
30
        );
31 1
        $builder->add('title', TextType::class, array(
32 1
            'label' => 'pagepart.header.title',
33
            'required' => true,
34
        ));
35 1
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getBlockPrefix()
41
    {
42
        return 'kunstmaan_pagepartbundle_headerpageparttype';
43
    }
44
45
    /**
46
     * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
47
     */
48 1
    public function configureOptions(OptionsResolver $resolver)
49
    {
50 1
        $resolver->setDefaults(
51
          array(
52 1
            'data_class' => 'Kunstmaan\PagePartBundle\Entity\HeaderPagePart',
53
          )
54
        );
55 1
    }
56
}
57