mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
remove deprecated templating component
This commit is contained in:
parent
4028cc8a8b
commit
7a5db59ac2
@ -48,7 +48,6 @@
|
||||
"symfony/monolog-bundle": "^3.5",
|
||||
"symfony/security-bundle": "^4.4",
|
||||
"symfony/serializer": "^5.3",
|
||||
"symfony/templating": "^4.4",
|
||||
"symfony/translation": "^4.4",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"symfony/validator": "^4.4",
|
||||
|
@ -24,6 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use Twig\Environment;
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
@ -42,20 +43,16 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
|
||||
final public const OTHER_VALUE_LABEL = 'otherValueLabel';
|
||||
|
||||
private $defaultLocales;
|
||||
|
||||
/**
|
||||
* CustomFieldChoice constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
private readonly TwigEngine $templating,
|
||||
private readonly Environment $templating,
|
||||
/**
|
||||
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
|
||||
*/
|
||||
private readonly TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->defaultLocales = $translator->getFallbackLocales();
|
||||
}
|
||||
|
||||
public function allowOtherChoice(CustomField $cf)
|
||||
@ -307,7 +304,6 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
'selected' => $selected,
|
||||
'multiple' => $customField->getOptions()[self::MULTIPLE],
|
||||
'expanded' => $customField->getOptions()[self::EXPANDED],
|
||||
'locales' => $this->defaultLocales,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* Create a custom date number.
|
||||
@ -44,8 +45,10 @@ class CustomFieldDate extends AbstractCustomField
|
||||
*/
|
||||
final public const MIN = 'min';
|
||||
|
||||
public function __construct(private readonly TwigEngine $templating, private readonly TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Environment $templating,
|
||||
private readonly TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
|
@ -20,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Symfony\Component\Validator\Constraints\LessThanOrEqual;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* Create a custom field number.
|
||||
@ -39,8 +40,10 @@ class CustomFieldNumber extends AbstractCustomField
|
||||
|
||||
final public const SCALE = 'scale';
|
||||
|
||||
public function __construct(private readonly TwigEngine $templating, private readonly TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Environment $templating,
|
||||
private readonly TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
|
@ -21,6 +21,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
use Twig\Environment;
|
||||
use function array_key_exists;
|
||||
|
||||
class CustomFieldText extends AbstractCustomField
|
||||
@ -30,11 +31,7 @@ class CustomFieldText extends AbstractCustomField
|
||||
final public const MULTIPLE_CF_INLINE = 'multipleCFInline';
|
||||
|
||||
public function __construct(
|
||||
private readonly RequestStack $requestStack,
|
||||
private readonly TwigEngine $templating,
|
||||
/**
|
||||
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
|
||||
*/
|
||||
private readonly Environment $templating,
|
||||
private readonly TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ use Symfony\Bundle\TwigBundle\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Twig\Environment;
|
||||
|
||||
class CustomFieldTitle extends AbstractCustomField
|
||||
{
|
||||
@ -28,8 +29,7 @@ class CustomFieldTitle extends AbstractCustomField
|
||||
final public const TYPE_TITLE = 'title';
|
||||
|
||||
public function __construct(
|
||||
private readonly RequestStack $requestStack,
|
||||
private readonly TwigEngine $templating,
|
||||
private readonly Environment $templating,
|
||||
/**
|
||||
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
|
||||
*/
|
||||
|
@ -37,18 +37,15 @@ services:
|
||||
|
||||
chill.custom_field.text:
|
||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldText
|
||||
arguments:
|
||||
- "@request_stack"
|
||||
- "@templating"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: 'chill.custom_field', type: 'text' }
|
||||
|
||||
chill.custom_field.number:
|
||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber
|
||||
arguments:
|
||||
- "@templating"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: 'chill.custom_field', type: 'number' }
|
||||
|
||||
@ -64,10 +61,8 @@ services:
|
||||
|
||||
chill.custom_field.choice:
|
||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice
|
||||
arguments:
|
||||
- "@translator.default"
|
||||
- "@templating"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: 'chill.custom_field', type: 'choice' }
|
||||
|
||||
@ -85,18 +80,15 @@ services:
|
||||
|
||||
chill.custom_field.title:
|
||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldTitle
|
||||
arguments:
|
||||
- "@request_stack"
|
||||
- "@templating"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: 'chill.custom_field', type: 'title' }
|
||||
|
||||
chill.custom_field.date:
|
||||
class: Chill\CustomFieldsBundle\CustomFields\CustomFieldDate
|
||||
arguments:
|
||||
- "@templating"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: 'chill.custom_field', type: 'date' }
|
||||
|
||||
|
@ -49,7 +49,7 @@ class LoadCustomFields extends AbstractFixture implements
|
||||
/**
|
||||
* LoadCustomFields constructor.
|
||||
*/
|
||||
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator)
|
||||
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
@ -78,7 +78,6 @@ class LoadCustomFields extends AbstractFixture implements
|
||||
private function createCustomFieldChoice()
|
||||
{
|
||||
return new CustomFieldChoice(
|
||||
$this->translator,
|
||||
$this->container->get('templating'),
|
||||
$this->translatableStringHelper
|
||||
);
|
||||
@ -87,7 +86,6 @@ class LoadCustomFields extends AbstractFixture implements
|
||||
private function createCustomFieldText()
|
||||
{
|
||||
return new CustomFieldText(
|
||||
$this->container->get('request_stack'),
|
||||
$this->container->get('templating'),
|
||||
$this->translatableStringHelper
|
||||
);
|
||||
|
@ -6,7 +6,6 @@ services:
|
||||
tags: [ 'doctrine.fixture.orm' ]
|
||||
|
||||
Chill\PersonBundle\DataFixtures\ORM\LoadCustomFields:
|
||||
arguments:
|
||||
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags: [ 'doctrine.fixture.orm' ]
|
||||
|
@ -25,6 +25,3 @@ framework:
|
||||
## sf4 check: ou à déplacer dans un chill.yaml
|
||||
assets:
|
||||
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
|
||||
|
||||
templating:
|
||||
engines: ['twig']
|
||||
|
Loading…
x
Reference in New Issue
Block a user