|
|
@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Form\Setting; |
|
|
|
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
|
|
|
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface; |
|
|
|
use Lc\SovBundle\Form\Common\FileManagerType; |
|
|
|
use Lc\SovBundle\Translation\TranslatorAdmin; |
|
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
|
|
|
use Symfony\Component\Form\Extension\Core\Type\DateType; |
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
|
|
@@ -17,13 +18,16 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
{ |
|
|
|
protected EntityManagerInterface $em; |
|
|
|
protected SiteSettingDefinitionInterface $settingDefinition; |
|
|
|
protected TranslatorAdmin $translatorAdmin; |
|
|
|
|
|
|
|
public function __construct( |
|
|
|
EntityManagerInterface $entityManager, |
|
|
|
SiteSettingDefinitionInterface $settingDefinition |
|
|
|
SiteSettingDefinitionInterface $settingDefinition, |
|
|
|
TranslatorAdmin $translatorAdmin |
|
|
|
) { |
|
|
|
$this->em = $entityManager; |
|
|
|
$this->settingDefinition = $settingDefinition; |
|
|
|
$this->translatorAdmin = $translatorAdmin; |
|
|
|
} |
|
|
|
|
|
|
|
public function buildFormSetting($label, $form, $settingDefinition, $settingEntity) |
|
|
@@ -37,7 +41,8 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
'text', |
|
|
|
TextType::class, |
|
|
|
[ |
|
|
|
'label' => $label |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
] |
|
|
|
); |
|
|
|
} elseif ($settingType == 'textarea') { |
|
|
@@ -45,7 +50,8 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
'text', |
|
|
|
TextareaType::class, |
|
|
|
[ |
|
|
|
'label' => $label |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
] |
|
|
|
); |
|
|
|
} elseif ($settingType == 'textarea_advanced') { |
|
|
@@ -54,6 +60,7 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
CKEditorType::class, |
|
|
|
[ |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
'attr' => [ |
|
|
|
'class' => 'field-text_editor' |
|
|
|
] |
|
|
@@ -65,6 +72,7 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
ChoiceType::class, |
|
|
|
[ |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
'expanded' => false, |
|
|
|
'multiple' => false, |
|
|
|
'placeholder' => false, |
|
|
@@ -77,6 +85,7 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
ChoiceType::class, |
|
|
|
[ |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
'expanded' => true, |
|
|
|
'multiple' => false, |
|
|
|
'placeholder' => false, |
|
|
@@ -89,6 +98,7 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
DateType::class, |
|
|
|
[ |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
'widget' => 'single_text', |
|
|
|
] |
|
|
|
); |
|
|
@@ -98,6 +108,7 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
TimeType::class, |
|
|
|
[ |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
'input' => 'datetime', |
|
|
|
'widget' => 'single_text', |
|
|
|
] |
|
|
@@ -108,6 +119,7 @@ abstract class BaseSettingType extends AbstractType |
|
|
|
FileManagerType::class, |
|
|
|
[ |
|
|
|
'label' => $label, |
|
|
|
'translation_domain' => 'admin', |
|
|
|
'attr' => [ |
|
|
|
'type' => $settingType |
|
|
|
] |