Skip to content

Instantly share code, notes, and snippets.

@dbu
Created November 4, 2013 13:20
Show Gist options
  • Save dbu/7302316 to your computer and use it in GitHub Desktop.
Save dbu/7302316 to your computer and use it in GitHub Desktop.
extend edit template
{% block form %}
{% set url = admin.id(object) is not null ? 'edit' : 'create' %}
{% if not admin.hasRoute(url)%}
<div>
{{ "form_not_available"|trans({}, "SonataAdminBundle") }}
</div>
{% else %}
<form class="form-horizontal"
action="{{ admin.generateUrl(url, {'id': admin.id(object), 'uniqid': admin.uniqid, 'subclass': app.request.get('subclass')}) }}" {{ form_enctype(form) }}
method="POST"
{% if not admin_pool.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
>
{% if form.vars.errors|length > 0 %}
<div class="sonata-ba-form-error">
{{ form_errors(form) }}
</div>
{% endif %}
{% include "LiipchCoreBundle:Form:header_item.html.twig" with {"header_item_name": "item", "header_item": form, "id": admin.uniqid } %}
{{ form_rest(form) }}
{{ block('formactions') }}
</form>
{% endif%}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment