<?php


namespace AutoAdmin\Bundle\Menu\Form;


use AutoAdmin\Bundle\Menu\Entity\MenuItem;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class MenuItemTypeType extends AbstractType
{
    public function configureOptions(OptionsResolver $resolver)
    {
        $transKey = 'menu_item.item_type.';
        $resolver->setDefaults(
            [
                'empty_data' => MenuItem::TYPE_TEXT,
                'placeholder' => false,
                'choices' => [
                    $transKey . MenuItem::TYPE_TEXT => MenuItem::TYPE_TEXT,
                    $transKey . MenuItem::TYPE_LINK_URL => MenuItem::TYPE_LINK_URL,
                    $transKey . MenuItem::TYPE_LINK_CONTENT => MenuItem::TYPE_LINK_CONTENT,
                ],
            ]
        );
    }

    public function getParent(): string
    {
        return ChoiceType::class;
    }
}
