<?php

namespace App\Form;

use App\Entity\WidgetFormInput;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;

class WidgetFormInputType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('text')
            ->add('type', ChoiceType::class, [
                'choices'  => [
                    'Строка' => 'text',
                    'Телефон' => 'phone',
                    'Календаль' => 'date',
                    'Коментарий' => 'textarea',
                ],
                'empty_data' => null,
                'required'   => false
            ])
            ->add('bitrix24Id')
            ->add('sort')
            
        ;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => WidgetFormInput::class,
        ]);
    }
}
