Code Duplication    Length = 40-41 lines in 3 locations

src/Kunstmaan/FormBundle/Form/CheckboxPagePartAdminType.php 1 location

@@ 14-53 (lines=40) @@
11
/**
12
 * This class represents the type for the CheckboxPagePart
13
 */
14
class CheckboxPagePartAdminType extends AbstractType
15
{
16
    /**
17
     * @param FormBuilderInterface $builder The form builder
18
     * @param array                $options The options
19
     */
20
    public function buildForm(FormBuilderInterface $builder, array $options)
21
    {
22
        $builder
23
            ->add('label', TextType::class, [
24
                'label' => 'kuma_form.form.checkbox_page_part.label.label',
25
                'required' => true,
26
            ])
27
            ->add('required', CheckboxType::class, [
28
                'label' => 'kuma_form.form.checkbox_page_part.required.label',
29
                'required' => false,
30
            ])
31
            ->add('errormessage_required', TextType::class, [
32
                'label' => 'kuma_form.form.checkbox_page_part.errormessage_required.label',
33
                'required' => false,
34
            ])
35
        ;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getBlockPrefix()
42
    {
43
        return 'kunstmaan_formbundle_checkboxpageparttype';
44
    }
45
46
    public function configureOptions(OptionsResolver $resolver)
47
    {
48
        $resolver->setDefaults(['data_class' => 'Kunstmaan\FormBundle\Entity\PageParts\CheckboxPagePart']);
49
    }
50
}
51

src/Kunstmaan/FormBundle/Form/FileUploadPagePartAdminType.php 1 location

@@ 14-54 (lines=41) @@
11
/**
12
 * This class represents the type for the file FileUploadPagePart
13
 */
14
class FileUploadPagePartAdminType extends AbstractType
15
{
16
    /**
17
     * @param FormBuilderInterface $builder The form builder
18
     * @param array                $options The options
19
     */
20
    public function buildForm(FormBuilderInterface $builder, array $options)
21
    {
22
        $builder
23
            ->add('label', TextType::class, [
24
                'required' => true,
25
                'label' => 'kuma_form.form.file_upload_page_part.label.label',
26
            ])
27
            ->add('required', CheckboxType::class, [
28
                'required' => false,
29
                'label' => 'kuma_form.form.file_upload_page_part.required.label',
30
            ])
31
            ->add('errormessage_required', TextType::class, [
32
                'required' => false,
33
                'label' => 'kuma_form.form.file_upload_page_part.errormessage_required.label',
34
            ])
35
        ;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getBlockPrefix()
42
    {
43
        return 'kunstmaan_formbundle_fileuploadpageparttype';
44
    }
45
46
    public function configureOptions(OptionsResolver $resolver)
47
    {
48
        $resolver->setDefaults(['data_class' => 'Kunstmaan\FormBundle\Entity\PageParts\FileUploadPagePart']);
49
    }
50
}
51

src/Kunstmaan/PagePartBundle/Form/LinkPagePartAdminType.php 1 location

@@ 15-55 (lines=41) @@
12
/**
13
 * LinkPagePartAdminType
14
 */
15
class LinkPagePartAdminType extends AbstractType
16
{
17
    public function buildForm(FormBuilderInterface $builder, array $options)
18
    {
19
        $builder
20
            ->add('url', URLChooserType::class, [
21
                'label' => false,
22
                'required' => false,
23
            ])
24
            ->add('openinnewwindow', CheckboxType::class, [
25
                'label' => 'pagepart.link.openinnewwindow',
26
                'required' => false,
27
            ])
28
            ->add('text', TextType::class, [
29
                'label' => 'pagepart.link.text',
30
                'required' => false,
31
            ]);
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getBlockPrefix()
38
    {
39
        return 'kunstmaan_pagepartbundle_linkpageparttype';
40
    }
41
42
    public function configureOptions(OptionsResolver $resolver)
43
    {
44
        $resolver->setDefaults([
45
            'data_class' => 'Kunstmaan\PagePartBundle\Entity\LinkPagePart',
46
        ]);
47
    }
48
}
49