SectionType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
c 0
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 9 1
A getBlockPrefix() 0 3 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\SectionTranslationType;
14
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
15
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType;
16
use Symfony\Component\Form\Extension\Core\Type\TextType;
17
use Symfony\Component\Form\FormBuilderInterface;
18
19
final class SectionType extends AbstractResourceType
20
{
21
    public function buildForm(FormBuilderInterface $builder, array $options): void
22
    {
23
        $builder
24
            ->add('code', TextType::class, [
25
                'label' => 'bitbag_sylius_cms_plugin.ui.code',
26
                'disabled' => null !== $builder->getData()->getCode(),
27
            ])
28
            ->add('translations', ResourceTranslationsType::class, [
29
                'entry_type' => SectionTranslationType::class,
30
            ])
31
        ;
32
    }
33
34
    public function getBlockPrefix(): string
35
    {
36
        return 'bitbag_sylius_cms_plugin_section';
37
    }
38
}
39