CollectionTypeExtension::getExtendedType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FSi\Bundle\AdminBundle\Form;
6
7
use Symfony\Component\Form\AbstractTypeExtension;
8
use Symfony\Component\Form\FormInterface;
9
use Symfony\Component\Form\FormView;
10
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
11
12
class CollectionTypeExtension extends AbstractTypeExtension
13
{
14
    public static function getExtendedTypes()
15
    {
16
        return [CollectionType::class];
17
    }
18
19
    public function getExtendedType()
20
    {
21
        return CollectionType::class;
22
    }
23
24
    public function buildView(FormView $view, FormInterface $form, array $options): void
25
    {
26
        $view->vars['attr']['data-allow-add'] = (int) $options['allow_add'];
27
        $view->vars['attr']['data-allow-delete'] = (int) $options['allow_delete'];
28
        $view->vars['attr']['data-prototype-name'] = $options['prototype_name'];
29
    }
30
}
31