FrequentlyAskedQuestionType   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 17
c 0
b 0
f 0
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 22 1
1
<?php
2
3
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusCmsPlugin\Form\Type;
12
13
use BitBag\SyliusCmsPlugin\Form\Type\Translation\FrequentlyAskedQuestionTranslationType;
14
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType;
15
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
16
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType;
17
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
18
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
19
use Symfony\Component\Form\Extension\Core\Type\TextType;
20
use Symfony\Component\Form\FormBuilderInterface;
21
22
final class FrequentlyAskedQuestionType extends AbstractResourceType
23
{
24
    public function buildForm(FormBuilderInterface $builder, array $options): void
25
    {
26
        $builder
27
            ->add('code', TextType::class, [
28
                'label' => 'bitbag_sylius_cms_plugin.ui.code',
29
                'disabled' => null !== $builder->getData()->getCode(),
30
            ])
31
            ->add('position', IntegerType::class, [
32
                'label' => 'bitbag_sylius_cms_plugin.ui.position',
33
            ])
34
            ->add('enabled', CheckboxType::class, [
35
                'label' => 'bitbag_sylius_cms_plugin.ui.enabled',
36
            ])
37
            ->add('translations', ResourceTranslationsType::class, [
38
                'label' => false,
39
                'entry_type' => FrequentlyAskedQuestionTranslationType::class,
40
            ])
41
            ->add('channels', ChannelChoiceType::class, [
42
                'label' => 'bitbag_sylius_cms_plugin.ui.channels',
43
                'required' => false,
44
                'multiple' => true,
45
                'expanded' => true,
46
            ])
47
        ;
48
    }
49
}
50