<?php

namespace AutoAdmin\Bundle\Media\Form\Type\Media;

use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ImageMediaType extends FileMediaType
{
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);

//        $resolver->setDefault('data_class', ImageMedia::class);
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $data = $builder->getData();

        if (!empty($data) && !empty($data->getId())) {
            $builder->add('alt', TextType::class, [
                'property_path' => 'currentTranslation.alt',
            ]);
        }
    }
}
