<?php

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

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

class ImageMediaType extends FileMediaType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        parent::buildForm($builder, $options);

        $data = $builder->getData();

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