Template media Sonata Media Bundle - Symfony 4

0

Hello, how about I come to you since I am stuck with Sonata Media Bundle with Symfony 4.

I have already configured everything according to the documentation and it works correctly, but the template that is used to render the "Add Image" buttons appear as follows:

Previously I used the bundle with Symfony 3, and the template that rendered this section appeared in this other way:

As you can see it is a more orderly and easier way for the user. However, I have not been able to find my mistake or that I'm missing.

Thanks in advance to the community.

Greetings!

    
asked by Amado 18.06.2018 в 01:53
source

1 answer

0

After much research and review in my previous project made in Symfony 3.

I realize that to make the form visible correctly instead of placing the field that contains the image:

$builder->add('media', 'sonata_media_type', array(
     'provider' => 'sonata.media.provider.youtube',
     'context'  => 'default'
));

It should be placed like this, simpler.

class OgaUsersAdmin extends AbstractAdmin
    {
        protected function configureFormFields(FormMapper $formMapper)
    {
            $formMapper->add('userFirstname', TextType::class)
                       ->add('userImage', ModelListType::class);
    }

I hope it serves you.

Greetings !!

    
answered by 13.07.2018 / 01:32
source