Completed
Pull Request — 5.0 (#2163)
by Kevin
13:16
created

Form/AudioPagePartAdminType.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\MediaPagePartBundle\Form;
4
5
use Kunstmaan\MediaBundle\Form\Type\MediaType;
6
use Symfony\Component\Form\AbstractType;
7
8
use Symfony\Component\Form\FormBuilderInterface;
9
10
use Symfony\Component\OptionsResolver\OptionsResolver;
11
12
/**
13
 * AudioPagePartAdminType
14
 */
15 View Code Duplication
class AudioPagePartAdminType extends AbstractType
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
18
    /**
19
     * Builds the form.
20
     *
21
     * This method is called for each type in the hierarchy starting form the
22
     * top most type. Type extensions can further modify the form.
23
     * @param FormBuilderInterface $builder The form builder
24
     * @param array                $options The options
25
     *
26
     * @see FormTypeExtensionInterface::buildForm()
27
     */
28
    public function buildForm(FormBuilderInterface $builder, array $options)
29
    {
30
        $builder->add('media', MediaType::class, array(
31
            'mediatype' => 'audio',
32
            'label' => 'mediapagepart.audio.choose',
33
        ));
34
    }
35
36
    /**
37
     * Returns the name of this type.
38
     *
39
     * @return string The name of this type
40
     */
41
    public function getBlockPrefix()
42
    {
43
        return 'kunstmaan_mediabundle_audiopageparttype';
44
    }
45
46
    /**
47
     * Sets the default options for this type.
48
     *
49
     * @param OptionsResolver $resolver The resolver for the options.
50
     */
51
    public function configureOptions(OptionsResolver $resolver)
52
    {
53
        $resolver->setDefaults(array(
54
                'data_class' => 'Kunstmaan\MediaPagePartBundle\Entity\AudioPagePart',
55
        ));
56
    }
57
}
58