sonata-adminsymfony-sonata

Sonata Admin Bundle: show total count of collection on list view


Is there any way to show total count of collection on list view? Imagine that there is a user that can have many links. How can I show total links count on list view?


Solution

  • Found answer here:

    SonataAdminBundle custom rendering of text fields in list

    I'm using Sonata 2.3 so TWIG template should be like:

    {% extends admin.getTemplate('base_list_field') %}
    
    {% block field %}
        {{ value|length }}
    {% endblock %}