Explorar el Código

Merge branch 'develop'

develop
Guillaume hace 3 años
padre
commit
ff40698f06
Se han modificado 2 ficheros con 16 adiciones y 3 borrados
  1. +15
    -3
      Form/Setting/BaseSettingType.php
  2. +1
    -0
      Resources/views/admin/setting/form.html.twig

+ 15
- 3
Form/Setting/BaseSettingType.php Ver fichero

@@ -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
]

+ 1
- 0
Resources/views/admin/setting/form.html.twig Ver fichero

@@ -11,6 +11,7 @@
{# content #}
{% block content %}
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %}
{% trans_default_domain 'admin' %}
{{ form_start(form) }}

{# panes #}

Cargando…
Cancelar
Guardar