create_button.html.twig 1.1 KB

123456789101112131415161718192021222324252627282930
  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. {% if admin.hasAccess('create') and admin.hasRoute('create') %}
  8. {% if admin.subClasses is empty %}
  9. <li>
  10. <a class="sonata-action-element" href="{{ admin.generateUrl('create') }}">
  11. <i class="fa fa-plus-circle" aria-hidden="true"></i>
  12. {{ 'link_action_create'|trans({}, 'SonataAdminBundle') }}
  13. </a>
  14. </li>
  15. {% else %}
  16. {% for subclass in admin.subclasses|keys %}
  17. <li>
  18. <a class="sonata-action-element" href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">
  19. <i class="fa fa-plus-circle" aria-hidden="true"></i>
  20. {{ 'link_action_create'|trans({}, 'SonataAdminBundle') }} {{ subclass|trans({}, admin.translationdomain) }}
  21. </a>
  22. </li>
  23. {% endfor %}
  24. {% endif %}
  25. {% endif %}