create_button.html.twig 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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.hasRoute('create') and admin.isGranted('CREATE')%}
  8. {% if admin.subClasses is empty %}
  9. <a class="btn sonata-action-element" href="{{ admin.generateUrl('create') }}">
  10. <i class="icon-plus"></i>
  11. {{ 'link_action_create'|trans({}, 'SonataAdminBundle') }}</a>
  12. {% else %}
  13. <span class="btn-group sonata-action-element">
  14. <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
  15. <i class="icon-plus"></i>
  16. {{ 'link_action_create'|trans({}, 'SonataAdminBundle') }}
  17. <span class="caret"></span>
  18. </a>
  19. <ul class="dropdown-menu">
  20. {% for subclass in admin.subclasses|keys %}
  21. <li>
  22. <a href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">{{ subclass|trans({}, admin.translationdomain) }}</a>
  23. </li>
  24. {% endfor %}
  25. </ul>
  26. </span>
  27. {% endif %}
  28. {% endif %}