|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Form; |
|
4
|
|
|
|
|
5
|
|
|
use App\Entity\Settings; |
|
6
|
|
|
use Symfony\Component\Form\AbstractType; |
|
7
|
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType; |
|
8
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
9
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
10
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
|
11
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
|
12
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType; |
|
13
|
|
|
|
|
14
|
|
|
class SettingsType extends AbstractType |
|
15
|
|
|
{ |
|
16
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
|
17
|
|
|
{ |
|
18
|
|
|
$builder |
|
19
|
|
|
->add('siteTitle', TextType::class, [ |
|
20
|
|
|
'label' => 'Site Title' |
|
21
|
|
|
]) |
|
22
|
|
|
->add('siteSubtitle', TextType::class, [ |
|
23
|
|
|
'label' => 'Site Sub-title' |
|
24
|
|
|
]) |
|
25
|
|
|
->add('twitterHandle', TextType::class, [ |
|
26
|
|
|
'label' => 'Twitter Handle for Twitter Cards (without "@")', |
|
27
|
|
|
'required' => false |
|
28
|
|
|
]) |
|
29
|
|
|
->add('gravatarEmail', TextType::class, [ |
|
30
|
|
|
'label' => 'Gravatar Email Address for avatar on About page', |
|
31
|
|
|
'required' => false |
|
32
|
|
|
]) |
|
33
|
|
|
->add('siteAbout', TextareaType::class, [ |
|
34
|
|
|
'label' => 'About Page text', |
|
35
|
|
|
'attr' => ['rows' => 10] |
|
36
|
|
|
]); |
|
37
|
|
|
$builder |
|
38
|
|
|
->add('save', SubmitType::class, ['label' => 'Save']); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function configureOptions(OptionsResolver $resolver) |
|
42
|
|
|
{ |
|
43
|
|
|
$resolver->setDefaults([ |
|
44
|
|
|
'data_class' => Settings::class, |
|
45
|
|
|
'type' => 'standard' |
|
46
|
|
|
]); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|