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