phpsymfonysonata-adminsonatasonata-media-bundle

Disable "list" leaving only "add new" and "delete"


I have a project that is using SonataMediaBundle, and I am working on the GalleryAdmin page. My goal is to only allow uploads of images, rather than allowing images and videos.

I have set up sonata_media.yml so that inline uploads of new media only allow images. However, if there are existing Media records that contain video -- YouTube records, for instance -- the gallery allows selection of those video items alongside images. This is not the desired behavior.

How do I change my GalleryAdmin (or other files) so that selection of existing Media records is not possible, and only fresh uploads are allowed? This would fix the problem.

====

Edit: To clarify, I basically want to remove the "List" button from my Media list view, leaving only "Add new" and "Delete."


Solution

  • Check The available options are section here, you can disable any button.

    Edit:

    Just extends this and overwrite the formFields and there you need to hide list option for media field.