51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Form;
|
|
|
|
use App\Entity\TeamContact;
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use App\Core\Form\Type\CollectionType;
|
|
|
|
class TeamContactType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
{
|
|
$builder
|
|
->add('name')
|
|
->add('phones', CollectionType::class, [
|
|
'collection_name' => 'phones_collection',
|
|
'entry_type' => ContactPhoneType::class,
|
|
'allow_add' => true,
|
|
'allow_delete' => true,
|
|
'by_reference' => false,
|
|
'prototype' => true,
|
|
'label' => 'Téléphone(s)',
|
|
'row_attr' => [
|
|
'class' => 'col-md-12',
|
|
],
|
|
])
|
|
->add('emails', CollectionType::class, [
|
|
'collection_name' => 'emails_collection',
|
|
'entry_type' => ContactEmailType::class,
|
|
'allow_add' => true,
|
|
'allow_delete' => true,
|
|
'by_reference' => false,
|
|
'prototype' => true,
|
|
'row_attr' => [
|
|
'class' => 'col-md-12',
|
|
],
|
|
])
|
|
;
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver): void
|
|
{
|
|
$resolver->setDefaults([
|
|
'data_class' => TeamContact::class,
|
|
]);
|
|
}
|
|
}
|