sonata-project / SonataFormatterBundle

Symfony SonataFormatterBundle
https://docs.sonata-project.org/projects/SonataFormatterBundle
MIT License
81 stars 117 forks source link

fix: change list_outer_rows_browser.html.twig template name. #720

Closed m-ar-c closed 2 years ago

m-ar-c commented 2 years ago

Subject

outer_list_rows_browser does not match any current template name in Sonata. With outer_list_rows_list instead, the list_outer_rows_browser.html.twig template is used and the javascript in browser.html.twig is working again (we can select images by clicking on them).

I am targeting this branch, because it is a BC fix.

Changelog

### Fixed
- Fix wrong template name preventing users to select images.
jordisala1991 commented 2 years ago

I don't think this change is correct, test are failing.

m-ar-c commented 2 years ago

Right, this is not correct. I had the following

    public function configureListFields(ListMapper $list): void
    {
            $list->getAdmin()->setListMode('list');
    }

in an other Admin Extension also targeting sonata.media.admin.media. This was responsible for the bug.

I changed it to :

    public function configureListFields(ListMapper $list): void
    {
            if ('browser' !== $list->getAdmin()->getListMode())
                $list->getAdmin()->setListMode('list');
    }

Now everything works as it should. Sorry for the noise.