<?php

namespace Vipa\AdminBundle\Form\Type;

use Vipa\JournalBundle\Entity\ContactTypes;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ContactTypesType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('translations', 'a2lix_translations', [
                'fields' => [
                    'name' => [
                        'required' => true
                    ],
                    'description' => [
                        'required' => false
                    ]
                ]
            ])
        ;
    }

    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            array(
                'data_class' => ContactTypes::class,
                'cascade_validation'=>true,
                'attr' => [
                    'class' => 'form-validate',
                ],
            )
        );
    }
}
