<?php

namespace App\Form;

use App\Entity\Campaign\LandingPage;
use App\Entity\CommentLandingPage;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CommentLandingPageType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('landingPage', EntityType::class, [
                'label' => 'Landing Page',
                'class' => LandingPage::class,
                'choice_value' => 'id',
                'choice_label' => 'url',
            ])
            ->add('description', TextType::class, [
                'label' => 'Description',
            ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => CommentLandingPage::class,
            'allow_extra_fields' => true,
            'csrf_protection' => false,
        ]);
    }
}
