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