简体   繁体   中英

add a custom button 'download all files' in sonata admin bundle symfony2

I want to have a button same as 'Add New' available in sonata bundle. I don't know how to add it.

I found the code(base_list.html.twig) which creates 'Add New' but I don't know how making it customize for every page.

{% block actions %}
<div class="sonata-actions btn-group">
    {% include 'SonataAdminBundle:Core:create_button.html.twig' %}
</div>
{% endblock %}

Any help will be really appreciated.

I override the sonata admin template for my specific admin action by adding these lines in my services.yml

    my.admin.my:
    class: MyBundle\Admin\MyAdmin
    arguments: [~, -\-Bundle\Entity\-, SonataAdminBundle:CRUD]
    tags:
        - {name: sonata.admin, manager_type: orm, group: -, label: "- Records"}
    calls:
        - [setTemplate, [list, MyBundle:MyAdmin:list.html.twig]] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM