<?php


namespace AutoAdmin\Bundle\Seo\Form;


use AutoAdmin\Bundle\Admin\Form\Type\AdminFormType;
use AutoAdmin\Bundle\Media\Form\Type\Media\LinkedMediaType;
use AutoAdmin\Bundle\Seo\Entity\OpenGraphMetadata;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class OpenGraphMetadataType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            'image',
            LinkedMediaType::class,
            [
                'label' => 'open_graph.form.image',
                'required' => false,
            ]
        );
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);

        $resolver->setDefault('data_class', OpenGraphMetadata::class);
        $resolver->setDefault('label', false);
    }

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