You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.7 KiB
74 lines
2.7 KiB
<?php
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
namespace Chamilo\CoreBundle\Settings;
|
|
|
|
use Chamilo\CoreBundle\Form\Type\YesNoType;
|
|
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
/**
|
|
* Class LanguageSettingsSchema.
|
|
*
|
|
* @package Chamilo\CoreBundle\Settings
|
|
*/
|
|
class LanguageSettingsSchema extends AbstractSettingsSchema
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function buildSettings(SettingsBuilderInterface $builder)
|
|
{
|
|
$builder
|
|
->setDefaults(
|
|
[
|
|
'platform_language' => 'en',
|
|
'allow_use_sub_language' => 'false',
|
|
'auto_detect_language_custom_pages' => 'true',
|
|
'show_different_course_language' => 'true',
|
|
'language_priority_1' => '',
|
|
'language_priority_2' => '',
|
|
'language_priority_3' => '',
|
|
'language_priority_4' => '',
|
|
'hide_dltt_markup' => 'false',
|
|
'show_language_selector_in_menu' => 'true',
|
|
]
|
|
);
|
|
|
|
$allowedTypes = [
|
|
'platform_language' => ['string'],
|
|
'allow_use_sub_language' => ['string'],
|
|
'auto_detect_language_custom_pages' => ['string'],
|
|
'show_different_course_language' => ['string'],
|
|
];
|
|
$this->setMultipleAllowedTypes($allowedTypes, $builder);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function buildForm(FormBuilderInterface $builder)
|
|
{
|
|
$choices = [
|
|
'' => '',
|
|
'PlatformLanguage' => 'platform_lang', // default platform language
|
|
'UserLanguage' => 'user_profil_lang', // profile language of current user
|
|
'UserSelectedLanguage' => 'user_selected_lang', // language selected by user at login
|
|
'CourseLanguage' => 'course_lang', // language of the current course
|
|
];
|
|
|
|
$builder
|
|
->add('platform_language', 'language')
|
|
->add('allow_use_sub_language', YesNoType::class)
|
|
->add('auto_detect_language_custom_pages', YesNoType::class)
|
|
->add('show_different_course_language', YesNoType::class)
|
|
->add('language_priority_1', ChoiceType::class, ['choices' => $choices])
|
|
->add('language_priority_2', ChoiceType::class, ['choices' => $choices])
|
|
->add('language_priority_3', ChoiceType::class, ['choices' => $choices])
|
|
->add('language_priority_4', ChoiceType::class, ['choices' => $choices])
|
|
->add('hide_dltt_markup')
|
|
->add('show_language_selector_in_menu', YesNoType::class)
|
|
;
|
|
}
|
|
}
|
|
|