1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Lakion\CmsPlugin\Form\Type; |
4
|
|
|
|
5
|
|
|
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; |
6
|
|
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
7
|
|
|
use Symfony\Component\Form\Extension\Core\Type\CollectionType; |
8
|
|
|
use Symfony\Component\Form\Extension\Core\Type\DateTimeType; |
9
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
11
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
12
|
|
|
|
13
|
|
|
final class StaticContentType extends AbstractResourceType |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritdoc} |
17
|
|
|
*/ |
18
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options = []) |
19
|
|
|
{ |
20
|
|
|
$builder |
21
|
|
|
->add('publishable', CheckboxType::class, [ |
22
|
|
|
'label' => 'lakion_cms.form.static_content.publishable', |
23
|
|
|
]) |
24
|
|
|
->add('id', TextType::class, [ |
25
|
|
|
'label' => 'lakion_cms.form.static_content.id', |
26
|
|
|
]) |
27
|
|
|
->add('name', TextType::class, [ |
28
|
|
|
'label' => 'lakion_cms.form.static_content.internal_name', |
29
|
|
|
]) |
30
|
|
|
->add('locale', TextType::class, [ |
31
|
|
|
'label' => 'lakion_cms.form.static_content.locale', |
32
|
|
|
]) |
33
|
|
|
->add('title', TextType::class, [ |
34
|
|
|
'label' => 'lakion_cms.form.static_content.title', |
35
|
|
|
]) |
36
|
|
|
->add('routes', CollectionType::class, [ |
37
|
|
|
'entry_type' => RouteType::class, |
38
|
|
|
'allow_add' => true, |
39
|
|
|
'allow_delete' => true, |
40
|
|
|
'by_reference' => false, |
41
|
|
|
'label' => 'lakion_cms.form.static_content.routes', |
42
|
|
|
]) |
43
|
|
|
->add('body', TextareaType::class, [ |
44
|
|
|
'required' => false, |
45
|
|
|
'label' => 'lakion_cms.form.static_content.body', |
46
|
|
|
]) |
47
|
|
|
->add('meta_keywords', TextType::class, [ |
48
|
|
|
'required' => false, |
49
|
|
|
'label' => 'lakion_cms.form.static_content.meta_keywords', |
50
|
|
|
]) |
51
|
|
|
->add('meta_description', TextareaType::class, [ |
52
|
|
|
'required' => false, |
53
|
|
|
'label' => 'lakion_cms.form.static_content.meta_description', |
54
|
|
|
]) |
55
|
|
|
->add('publishStartDate', DateTimeType::class, [ |
56
|
|
|
'label' => 'lakion_cms.form.static_content.publish_start_date', |
57
|
|
|
'placeholder' => ['year' => '-', 'month' => '-', 'day' => '-'], |
58
|
|
|
'time_widget' => 'text', |
59
|
|
|
]) |
60
|
|
|
->add('publishEndDate', DateTimeType::class, [ |
61
|
|
|
'label' => 'lakion_cms.form.static_content.publish_end_date', |
62
|
|
|
'placeholder' => ['year' => '-', 'month' => '-', 'day' => '-'], |
63
|
|
|
'time_widget' => 'text', |
64
|
|
|
]) |
65
|
|
|
; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* {@inheritdoc} |
70
|
|
|
*/ |
71
|
|
|
public function getBlockPrefix() |
72
|
|
|
{ |
73
|
|
|
return 'lakion_cms_static_content'; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|