base_edit.twig.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 actions %}
  9. <div class="sonata-actions">
  10. <ul>
  11. <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans "link_action_create" from admin.translationdomain %}</a></li>
  12. <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans "link_action_list" from admin.translationdomain %}</a></li>
  13. </ul>
  14. </div>
  15. {% endblock %}
  16. {% block side_menu %}{% if side_menu %}{{ side_menu.render|raw }}{% endif %}{% endblock %}
  17. {% block form %}
  18. <form action="{{ admin.generateUrl('update', {'id': object.id}) }}" method="POST">
  19. {{ form_hidden(form) }}
  20. {% if form.errors %}
  21. <div class="sonata-ba-form-error">
  22. {{ form_errors(form) }}
  23. </div>
  24. {% endif %}
  25. {% for name, form_group in form_groups %}
  26. {% if name %}
  27. <fieldset>
  28. <legend>
  29. {{ name }}
  30. {% if form_group.collapsed %}
  31. <a href="" class="sonata-ba-collapsed">{% trans 'link_expand' from 'BaseApplicationBundle' %}</a>
  32. {% endif %}
  33. </legend>
  34. <div class="sonata-ba-collapsed-fields">
  35. {% endif %}
  36. {% for field_name in form_group.fields %}
  37. {% if fields[field_name] is defined %}
  38. {{ fields[field_name]|render_form_element(form, object) }}
  39. {% endif %}
  40. {% endfor %}
  41. {% if name %}
  42. </div>
  43. </fieldset>
  44. {% endif %}
  45. {% endfor %}
  46. {% if app.request.isxmlhttprequest %}
  47. {% if object.id %}
  48. <input type="submit" name="btn_update" value="{% trans "btn_update" from admin.translationdomain %}"/>
  49. {% else %}
  50. <input type="submit" name="btn_create" value="{% trans "btn_create" from admin.translationdomain %}"/>
  51. {% endif %}
  52. {% else %}
  53. {% if object.id %}
  54. <input type="submit" name="btn_update_and_edit" value="{% trans "btn_update_and_edit_again" from admin.translationdomain %}"/>
  55. <input type="submit" name="btn_update_and_list" value="{% trans "btn_update_and_return_to_list" from admin.translationdomain %}"/>
  56. {% else %}
  57. <input type="submit" name="btn_create_and_edit" value="{% trans "btn_create_and_edit_again" from admin.translationdomain %}"/>
  58. <input type="submit" name="btn_create_and_create" value="{% trans "btn_create_and_create_a_new_one" from admin.translationdomain %}"/>
  59. {% endif %}
  60. {% endif %}
  61. </form>
  62. {% endblock %}