search.html.twig 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {% extends base_template %}
  8. {% block title %}{{ 'title_search_results'|trans({'%query%': query}, 'SonataAdminBundle') }}{% endblock %}
  9. {% block breadcrumb %}{% endblock %}
  10. {% block content %}
  11. <h2 class="page-header">{{ 'title_search_results'|trans({'%query%': query}, 'SonataAdminBundle') }}</h2>
  12. {% if query is defined and query is not same as(false) %}
  13. {% set count = 0 %}
  14. <div class="row" data-masonry='{ "itemSelector": ".search-box-item" }'>
  15. {% for group in groups %}
  16. {% set display = (group.roles is empty or is_granted('ROLE_SUPER_ADMIN') ) %}
  17. {% for role in group.roles if not display %}
  18. {% set display = is_granted(role) %}
  19. {% endfor %}
  20. {% if display %}
  21. {% for admin in group.items %}
  22. {% set count = count + 1 %}
  23. {% if admin.hasRoute('create') and admin.hasAccess('create') or admin.hasRoute('list') and admin.hasAccess('list') %}
  24. {{ sonata_block_render({
  25. 'type': 'sonata.admin.block.search_result'
  26. }, {
  27. 'query': query,
  28. 'admin_code': admin.code,
  29. 'page': 0,
  30. 'per_page': 10,
  31. 'icon': group.icon
  32. }) }}
  33. {% endif %}
  34. {% endfor %}
  35. {% endif %}
  36. {% endfor %}
  37. </div>
  38. {% endif %}
  39. {% endblock %}