<?php
namespace App\Form\BackOffice;
use App\Entity\Message;
use App\Form\ApplicationType\BackOffice;
use Symfony\Component\Form\AbstractType;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
class MessageType extends ApplicationType
{
/**
* permet d'avoir la configuration de base d'un champ !
*
* @param string $label
* @param string $placeholder
* @return array
*/
protected function getConfiguration($label, $placeholder)
{
return[
'label' => $label,
'attr' => [
'placeholder' => $placeholder
]
];
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('nom',TextType::class, $this->getConfiguration(false, "Nom..."))
->add('prenom',TextType::class, $this->getConfiguration(false, "Prénom(s)..."))
->add('telephone',TextType::class, $this->getConfiguration(false, "Téléphone..."))
->add('email',EmailType::class, $this->getConfiguration(false, "E-mail..."))
->add('adresse',TextType::class, $this->getConfiguration(false, "Adresse..."))
->add('message',CKEditorType::class, $this->getConfiguration(false, "Message..."));
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Message::class,
]);
}
}