Search code examples
phpcsvsonata-adminsonataexporter

Customize Download in the list view Sonata Admin


I want to remove csv, xml and json formats from Download. Where can i customize this page?

enter image description here


Solution

  • All you have to do right now is override the getExportFormats method of your admin, so that it returns the list of formats that you really want.

    In the future, you will be able to configure that globally thanks to this contribution I made.

    If you also want to change the button to a link, you need to override the list template, and customize the table_footer block (the template to override is vendor/sonata-project/admin-bundle/Resources/views/CRUD/base_list.html.twig), so just copy/paste and adapt the table_footer block.