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('publishStartDate', DateTimeType::class, [ |
48
|
|
|
'label' => 'lakion_cms.form.static_content.publish_start_date', |
49
|
|
|
'placeholder' => ['year' => '-', 'month' => '-', 'day' => '-'], |
50
|
|
|
'time_widget' => 'text', |
51
|
|
|
]) |
52
|
|
|
->add('publishEndDate', DateTimeType::class, [ |
53
|
|
|
'label' => 'lakion_cms.form.static_content.publish_end_date', |
54
|
|
|
'placeholder' => ['year' => '-', 'month' => '-', 'day' => '-'], |
55
|
|
|
'time_widget' => 'text', |
56
|
|
|
]) |
57
|
|
|
; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* {@inheritdoc} |
62
|
|
|
*/ |
63
|
|
|
public function getBlockPrefix() |
64
|
|
|
{ |
65
|
|
|
return 'lakion_cms_static_content'; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|