<?php
namespace App\Form;
use App\Entity\Report;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Hostname;
use Symfony\Component\Validator\Constraints\Sequentially;
class NewReportFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('domain', TextType::class, [
'constraints' => [
new Sequentially([
new Hostname(),
]),
],
'attr' => [
'placeholder' => 'example.com',
],
'label' => 'https://',
'row_attr' => [
'class' => 'input-group',
],
])
->add('Submit', SubmitType::class, [
'label' => 'Proceed <i class="fa-solid fa-angle-right ms-2"></i>',
'label_html' => true,
'row_attr' => [
'class' => 'mt-3',
],
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Report::class,
'csrf_protection' => false,
]);
}
}