SectionAutocompleteChoiceType::buildView()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
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 Sylius\Bundle\ResourceBundle\Form\Type\ResourceAutocompleteChoiceType;
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\Form\FormInterface;
16
use Symfony\Component\Form\FormView;
17
use Symfony\Component\OptionsResolver\OptionsResolver;
18
19
final class SectionAutocompleteChoiceType extends AbstractType
20
{
21
    public function configureOptions(OptionsResolver $resolver): void
22
    {
23
        $resolver->setDefaults([
24
            'resource' => 'bitbag_sylius_cms_plugin.section',
25
            'choice_name' => 'name',
26
            'choice_value' => 'code',
27
        ]);
28
    }
29
30
    public function buildView(
31
        FormView $view,
32
        FormInterface $form,
33
        array $options
34
    ): void {
35
        $view->vars['remote_criteria_type'] = 'contains';
36
        $view->vars['remote_criteria_name'] = 'phrase';
37
    }
38
39
    public function getBlockPrefix(): string
40
    {
41
        return 'bitbag_section_autocomplete_choice';
42
    }
43
44
    public function getParent(): string
45
    {
46
        return ResourceAutocompleteChoiceType::class;
47
    }
48
}
49