瀏覽代碼

Merge branch 'develop'

develop
Guillaume 3 年之前
父節點
當前提交
ff40698f06
共有 2 個檔案被更改,包括 16 行新增3 行删除
  1. +15
    -3
      Form/Setting/BaseSettingType.php
  2. +1
    -0
      Resources/views/admin/setting/form.html.twig

+ 15
- 3
Form/Setting/BaseSettingType.php 查看文件

@@ -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 查看文件

@@ -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 #}

Loading…
取消
儲存