Completed
Pull Request — master (#2349)
by Julito
31:02 queued 07:14
created

LanguageSettingsSchema::buildSettings()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 1
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Settings;
5
6
use Chamilo\CoreBundle\Form\Type\YesNoType;
7
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
8
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
9
use Symfony\Component\Form\FormBuilderInterface;
10
11
/**
12
 * Class LanguageSettingsSchema
13
 * @package Chamilo\CoreBundle\Settings
14
 */
15
class LanguageSettingsSchema extends AbstractSettingsSchema
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function buildSettings(SettingsBuilderInterface $builder)
21
    {
22
        $builder
23
            ->setDefaults(
24
                [
25
                    'platform_language' => 'en',
26
                    'allow_use_sub_language' => 'false',
27
                    'auto_detect_language_custom_pages' => 'true',
28
                    'show_different_course_language' => 'true',
29
                    'language_priority_1' => '',
30
                    'language_priority_2' => '',
31
                    'language_priority_3' => '',
32
                    'language_priority_4' => '',
33
                    'hide_dltt_markup' => 'false'
34
                ]
35
            );
36
37
        $allowedTypes = [
38
            'platform_language' => ['string'],
39
            'allow_use_sub_language' => ['string'],
40
            'auto_detect_language_custom_pages' => ['string'],
41
            'show_different_course_language' => ['string']
42
        ];
43
        $this->setMultipleAllowedTypes($allowedTypes, $builder);
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function buildForm(FormBuilderInterface $builder)
50
    {
51
        $builder
52
            ->add('platform_language', 'language')
53
            ->add('allow_use_sub_language', YesNoType::class)
54
            ->add('auto_detect_language_custom_pages', YesNoType::class)
55
            ->add('show_different_course_language', YesNoType::class)
56
            ->add('language_priority_1')
57
            ->add('language_priority_2')
58
            ->add('language_priority_3')
59
            ->add('language_priority_4')
60
            ->add('hide_dltt_markup')
61
        ;
62
    }
63
}
64