|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Odiseo\SyliusBannerPlugin\Form\Type; |
|
6
|
|
|
|
|
7
|
|
|
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType; |
|
8
|
|
|
use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber; |
|
9
|
|
|
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; |
|
10
|
|
|
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType; |
|
11
|
|
|
use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonAutocompleteChoiceType; |
|
12
|
|
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
|
13
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
14
|
|
|
|
|
15
|
|
|
final class BannerType extends AbstractResourceType |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* {@inheritdoc} |
|
19
|
|
|
*/ |
|
20
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
|
21
|
|
|
{ |
|
22
|
|
|
parent::buildForm($builder, $options); |
|
23
|
|
|
|
|
24
|
|
|
$builder |
|
25
|
|
|
->addEventSubscriber(new AddCodeFormSubscriber()) |
|
26
|
|
|
->add('enabled', CheckboxType::class, [ |
|
27
|
|
|
'label' => 'sylius.ui.enabled', |
|
28
|
|
|
]) |
|
29
|
|
|
->add('translations', ResourceTranslationsType::class, [ |
|
30
|
|
|
'entry_type' => BannerTranslationType::class, |
|
31
|
|
|
'label' => 'odiseo_sylius_banner_plugin.form.banner.translations', |
|
32
|
|
|
]) |
|
33
|
|
|
->add('taxons', TaxonAutocompleteChoiceType::class, [ |
|
34
|
|
|
'required' => false, |
|
35
|
|
|
'multiple' => true, |
|
36
|
|
|
'label' => 'odiseo_sylius_banner_plugin.form.banner.taxons', |
|
37
|
|
|
]) |
|
38
|
|
|
->add('channels', ChannelChoiceType::class, [ |
|
39
|
|
|
'required' => false, |
|
40
|
|
|
'multiple' => true, |
|
41
|
|
|
'expanded' => true, |
|
42
|
|
|
'label' => 'odiseo_sylius_banner_plugin.form.banner.channels', |
|
43
|
|
|
]) |
|
44
|
|
|
; |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|