mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
fix deprecations: use fqcn
This commit is contained in:
parent
23dd4ec48b
commit
7edd6affe4
@ -5,10 +5,15 @@ namespace Chill\CustomFieldsBundle\Form;
|
|||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\EntityType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||||
use Symfony\Component\Form\FormEvent;
|
use Symfony\Component\Form\FormEvent;
|
||||||
use Symfony\Component\Form\FormEvents;
|
use Symfony\Component\Form\FormEvents;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
||||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;
|
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;
|
||||||
|
|
||||||
|
|
||||||
@ -49,15 +54,15 @@ class CustomFieldType extends AbstractType
|
|||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('name', 'translatable_string')
|
->add('name', 'translatable_string')
|
||||||
->add('active', 'checkbox', array('required' => false));
|
->add('active', CheckboxType::class, array('required' => false));
|
||||||
|
|
||||||
if ($options['group_widget'] === 'entity') {
|
if ($options['group_widget'] === 'entity') {
|
||||||
$builder->add('customFieldsGroup', 'entity', array(
|
$builder->add('customFieldsGroup', EntityType::class, array(
|
||||||
'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup',
|
'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup',
|
||||||
'property' => 'name['.$this->culture.']'
|
'property' => 'name['.$this->culture.']'
|
||||||
));
|
));
|
||||||
} elseif ($options['group_widget'] === 'hidden') {
|
} elseif ($options['group_widget'] === 'hidden') {
|
||||||
$builder->add('customFieldsGroup', 'hidden');
|
$builder->add('customFieldsGroup', HiddenType::class);
|
||||||
$builder->get('customFieldsGroup')
|
$builder->get('customFieldsGroup')
|
||||||
->addViewTransformer(new CustomFieldsGroupToIdTransformer($this->om));
|
->addViewTransformer(new CustomFieldsGroupToIdTransformer($this->om));
|
||||||
} else {
|
} else {
|
||||||
@ -65,13 +70,13 @@ class CustomFieldType extends AbstractType
|
|||||||
}
|
}
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('ordering', 'number')
|
->add('ordering', NumberType::class)
|
||||||
->add('required', 'checkbox', array(
|
->add('required', CheckboxType::class, array(
|
||||||
'required' => false,
|
'required' => false,
|
||||||
//'expanded' => TRUE,
|
//'expanded' => TRUE,
|
||||||
'label' => 'Required field'
|
'label' => 'Required field'
|
||||||
))
|
))
|
||||||
->add('type', 'hidden', array('data' => $options['type']))
|
->add('type', HiddenType::class, array('data' => $options['type']))
|
||||||
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event)
|
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event)
|
||||||
{
|
{
|
||||||
$customField = $event->getData();
|
$customField = $event->getData();
|
||||||
@ -81,7 +86,7 @@ class CustomFieldType extends AbstractType
|
|||||||
// If no data is passed to the form, the data is "null".
|
// If no data is passed to the form, the data is "null".
|
||||||
// This should be considered a new "customField"
|
// This should be considered a new "customField"
|
||||||
if (!$customField || null === $customField->getId()) {
|
if (!$customField || null === $customField->getId()) {
|
||||||
$form->add('slug', 'text');
|
$form->add('slug', TextType::class);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user