AdminSettingsType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 45
c 1
b 0
f 0
dl 0
loc 70
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 59 1
A getBlockPrefix() 0 3 1
1
<?php
2
3
namespace App\Form;
4
5
use Sonata\FormatterBundle\Form\Type\SimpleFormatterType;
6
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\Form\Extension\Core\Type\TextType;
8
use Symfony\Component\Form\FormBuilderInterface;
9
use Symfony\Component\Validator\Constraints\Length;
10
use Symfony\Component\Validator\Constraints\NotNull;
11
12
class AdminSettingsType extends AbstractType
13
{
14
    public function buildForm(FormBuilderInterface $builder, array $options)
15
    {
16
        $builder
17
            ->add('new_user_email_template', SimpleFormatterType::class, [
18
                'format' => 'richhtml',
19
                'label' => 'New user email template',
20
                'attr' => ['class' => 'ckeditor'],
21
                'constraints' => [
22
                    new NotNull(),
23
                ],
24
            ])
25
            ->add('new_user_email_title', TextType::class, [
26
                'attr' => ['class' => 'form-control'],
27
                'label' => 'New user email title',
28
                'constraints' => [
29
                    new NotNull(), new Length(['min' => 3]),
30
                ],
31
            ])
32
            ->add('new_course_email_template', SimpleFormatterType::class, [
33
                'format' => 'richhtml',
34
                'label' => 'New course email template',
35
                'attr' => ['class' => 'ckeditor'],
36
                'constraints' => [
37
                    new NotNull(),
38
                ],
39
            ])
40
            ->add('new_course_email_title', TextType::class, [
41
                'attr' => ['class' => 'form-control'],
42
                'label' => 'New course email title',
43
                'constraints' => [
44
                    new NotNull(), new Length(['min' => 3]),
45
                ],
46
            ])
47
            ->add('password_reset_email_template', SimpleFormatterType::class, [
48
                'format' => 'richhtml',
49
                'label' => 'Password reset email template',
50
                'constraints' => [
51
                    new NotNull(),
52
                ],
53
            ])
54
            ->add('password_reset_email_title', TextType::class, [
55
                'attr' => ['class' => 'form-control'],
56
                'label' => 'Password reset email title',
57
                'constraints' => [
58
                    new NotNull(), new Length(['min' => 3]),
59
                ],
60
            ])
61
            ->add('email_from_address', TextType::class, [
62
                'attr' => ['class' => 'form-control'],
63
                'label' => 'Email address for sent emails',
64
                'constraints' => [
65
                    new NotNull(), new Length(['min' => 1]),
66
                ],
67
            ])
68
            ->add('email_from_name', TextType::class, [
69
                'attr' => ['class' => 'form-control'],
70
                'label' => 'Email name for sent emails',
71
                'constraints' => [
72
                    new NotNull(), new Length(['min' => 1]),
73
                ],
74
            ])
75
76
        ;
77
    }
78
79
    public function getBlockPrefix(): string
80
    {
81
        return 'settings';
82
    }
83
}
84