|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
/** |
|
5
|
|
|
* Created by PhpStorm. |
|
6
|
|
|
* User: Valery Maslov |
|
7
|
|
|
* Date: 01.11.2018 |
|
8
|
|
|
* Time: 11:13. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace App\Form\Type; |
|
12
|
|
|
|
|
13
|
|
|
use App\Entity\Page; |
|
14
|
|
|
use Symfony\Component\Form\AbstractType; |
|
15
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
|
16
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
17
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
18
|
|
|
|
|
19
|
|
|
final class PageType extends AbstractType |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* {@inheritdoc} |
|
23
|
|
|
*/ |
|
24
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
|
25
|
|
|
{ |
|
26
|
|
|
$builder |
|
27
|
|
|
->add('title', null, [ |
|
28
|
|
|
'attr' => [ |
|
29
|
|
|
'class' => 'form-control', |
|
30
|
|
|
], |
|
31
|
|
|
'label' => 'label.title', |
|
32
|
|
|
]) |
|
33
|
|
|
->add('slug', null, [ |
|
34
|
|
|
'attr' => [ |
|
35
|
|
|
'class' => 'form-control', |
|
36
|
|
|
], |
|
37
|
|
|
'label' => 'label.slug', |
|
38
|
|
|
]) |
|
39
|
|
|
->add('description', null, [ |
|
40
|
|
|
'attr' => [ |
|
41
|
|
|
'class' => 'form-control', |
|
42
|
|
|
], |
|
43
|
|
|
'label' => 'label.description', |
|
44
|
|
|
]) |
|
45
|
|
|
->add('locale', LanguageType::class) |
|
46
|
|
|
->add('content', TextareaType::class, [ |
|
47
|
|
|
'attr' => [ |
|
48
|
|
|
'class' => 'form-control summer-note', |
|
49
|
|
|
'rows' => '7', |
|
50
|
|
|
], |
|
51
|
|
|
'label' => 'label.content', |
|
52
|
|
|
'required' => false, |
|
53
|
|
|
]) |
|
54
|
|
|
->add('show_in_menu', null, [ |
|
55
|
|
|
'attr' => [ |
|
56
|
|
|
'class' => 'custom-control-input', |
|
57
|
|
|
], |
|
58
|
|
|
'label' => 'label.show_in_menu', |
|
59
|
|
|
'label_attr' => [ |
|
60
|
|
|
'class' => 'custom-control-label', |
|
61
|
|
|
], |
|
62
|
|
|
]) |
|
63
|
|
|
->add('add_contact_form', null, [ |
|
64
|
|
|
'attr' => [ |
|
65
|
|
|
'class' => 'custom-control-input', |
|
66
|
|
|
], |
|
67
|
|
|
'label' => 'label.add_contact_form', |
|
68
|
|
|
'label_attr' => [ |
|
69
|
|
|
'class' => 'custom-control-label', |
|
70
|
|
|
], |
|
71
|
|
|
]) |
|
72
|
|
|
->add('contact_email_address', null, [ |
|
73
|
|
|
'attr' => [ |
|
74
|
|
|
'class' => 'form-control', |
|
75
|
|
|
'placeholder' => 'placeholder.enter_email', |
|
76
|
|
|
], |
|
77
|
|
|
'label' => 'label.contact_email_address', |
|
78
|
|
|
]); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* {@inheritdoc} |
|
83
|
|
|
*/ |
|
84
|
|
|
public function configureOptions(OptionsResolver $resolver): void |
|
85
|
|
|
{ |
|
86
|
|
|
$resolver->setDefaults([ |
|
87
|
|
|
'data_class' => Page::class, |
|
88
|
|
|
]); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|