{# This file is part of the Sonata package. (c) Thomas Rabaix For the full copyright and license information, please view the LICENSE file that was distributed with this source code. #} {% extends 'SonataAdminBundle:Form:form_admin_fields.html.twig' %} {# Custom Sonata Admin Extension #} {% block sonata_admin_orm_one_to_one_widget %} {% include 'SonataDoctrineORMAdminBundle:CRUD:edit_orm_one_to_one.html.twig' %} {% endblock %} {% block sonata_admin_orm_many_to_many_widget %} {% include 'SonataDoctrineORMAdminBundle:CRUD:edit_orm_many_to_many.html.twig' %} {% endblock %} {% block sonata_admin_orm_many_to_one_widget %} {% include 'SonataDoctrineORMAdminBundle:CRUD:edit_orm_many_to_one.html.twig' %} {% endblock %} {% block sonata_admin_orm_one_to_many_widget %} {% include 'SonataDoctrineORMAdminBundle:CRUD:edit_orm_one_to_many.html.twig' %} {% endblock %} {% block sonata_type_model_widget %} {# This is not the best way to do if TODO : improve this part #} {#model {{ sonata_admin.field_description.mappingtype }}#} {% if sonata_admin.field_description is empty %} {{ block('choice_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::ONE_TO_ONE') %} {{ block('sonata_admin_orm_one_to_one_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::MANY_TO_ONE') %} {{ block('sonata_admin_orm_many_to_one_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::MANY_TO_MANY') %} {{ block('sonata_admin_orm_many_to_many_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::ONE_TO_MANY') %} {{ block('sonata_admin_orm_one_to_many_widget') }} {% else %} {#INVALID MODE : {{ id }}#} {{ block('choice_widget') }} {% endif %} {% endblock %} {% block sonata_type_model_list_widget %}
{% if sonata_admin.field_description.associationadmin.id(sonata_admin.value) %} {% render url('sonata_admin_short_object_information', { 'code': sonata_admin.field_description.associationadmin.code, 'objectId': sonata_admin.field_description.associationadmin.id(sonata_admin.value), 'uniqid': sonata_admin.field_description.associationadmin.uniqid, 'linkParameters': sonata_admin.field_description.options.link_parameters }) %} {% elseif sonata_admin.field_description.options.placeholder is defined and sonata_admin.field_description.options.placeholder %} {{ sonata_admin.field_description.options.placeholder|trans({}, 'SonataAdminBundle') }} {% endif %} {% if sonata_admin.field_description.associationadmin.hasroute('list') and sonata_admin.field_description.associationadmin.isGranted('LIST') and btn_list %} {{ btn_list|trans({}, btn_catalogue) }} {% endif %} {% if sonata_admin.field_description.associationadmin.hasroute('create') and sonata_admin.field_description.associationadmin.isGranted('CREATE') and btn_add %} {{ btn_add|trans({}, btn_catalogue) }} {% endif %} {% if sonata_admin.field_description.associationadmin.hasRoute('delete') and sonata_admin.field_description.associationadmin.isGranted('DELETE') and btn_delete %} {{ btn_delete|trans({}, btn_catalogue) }} {% endif %} {{ form_widget(form) }}
{% include 'SonataDoctrineORMAdminBundle:CRUD:edit_orm_many_association_script.html.twig' %} {% endblock %} {% block sonata_type_admin_widget %} {#admin {{ sonata_admin.field_description.mappingtype }}#} {% if sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::ONE_TO_ONE') %} {{ block('sonata_admin_orm_one_to_one_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::MANY_TO_ONE') %} {{ block('sonata_admin_orm_many_to_one_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::MANY_TO_MANY') %} {{ block('sonata_admin_orm_many_to_many_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::ONE_TO_MANY') %} {{ block('sonata_admin_orm_one_to_many_widget') }} {% else %} INVALID MODE : {{ id }} {% endif %} {% endblock %} {% block sonata_type_collection_widget %} {% if sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::ONE_TO_MANY') %} {{ block('sonata_admin_orm_one_to_many_widget') }} {% elseif sonata_admin.field_description.mappingtype == constant('Doctrine\\ORM\\Mapping\\ClassMetadataInfo::MANY_TO_MANY') %} {{ block('sonata_admin_orm_many_to_many_widget') }} {% else %} INVALID MODE : {{ id }} - type : sonata_type_collection - mapping : {{ sonata_admin.field_description.mappingtype }} {% endif %} {% endblock %}