{% import 'AppBundle:Admin:Common\\Macro\\macro_image.html.twig' as macro_image %} {% block sonata_media_type_row %} {% set label_class = "" %} {% set div_class = "" %} {% if sonata_admin.admin and sonata_admin.admin.getConfigurationPool().getOption('form_type') == 'horizontal' %} {% set label_class = "control-label col-sm-3" %} {# Remove col-md-* in order to center the media #} {% set div_class = "" %} {% else %} {% set label_class = "control-label" %} {% endif %} {% if sonata_admin is not defined or not sonata_admin_enabled or not sonata_admin.field_description %}
{{ form_label(form, label|default(null)) }}
{{ form_widget(form, {'horizontal': false, 'horizontal_input_wrapper_class': ''}) }} {# {'horizontal': false, 'horizontal_input_wrapper_class': ''} needed to avoid MopaBootstrapBundle messing with the DOM #} {% if errors|length > 0 %}
{{ form_errors(form) }}
{% endif %}
{% else %}
{% block label %} {% if sonata_admin.field_description.options.name is defined %} {{ form_label(form, sonata_admin.field_description.options.name, { 'attr' : {'class' : label_class} }) }} {% else %} {{ form_label(form, label|default(null), { 'attr' : {'class' : label_class} }) }} {% endif %} {% endblock %} {% set has_label = sonata_admin.field_description.options.name is defined or label is not sameas(false) %}
{{ form_widget(form, {'horizontal': false, 'horizontal_input_wrapper_class': ''}) }} {# {'horizontal': false, 'horizontal_input_wrapper_class': ''} needed to avoid MopaBootstrapBundle messing with the DOM #} {% if errors|length > 0 %}
{{ form_errors(form) }}
{% endif %} {% if sonata_admin.field_description.help %} {{ sonata_admin.admin.trans(sonata_admin.field_description.help, {}, sonata_admin.field_description.translationDomain)|raw }} {% endif %}
{% endif %} {% endblock sonata_media_type_row %} {% block sonata_media_type_widget %} {% if value.id != null %} {% set mediaEmpty = false %} {% else %} {% set mediaEmpty = true %} {% endif %} {% set mediaBinaryContentId = form.children['binaryContent'].vars.id %}
{% endblock sonata_media_type_widget %} {% block sonata_media_photo_view_type_widget %} {% if value.id != null %} {% set mediaEmpty = false %} {% else %} {% set mediaEmpty = true %} {% endif %} {% set mediaBinaryContentId = form.children['binaryContent'].vars.id %} {% set imgPath %}{% path value, 'large' %}{% endset %}
{# {{ form_widget(form.children['binaryContent']) }} #} {% spaceless %} {% endspaceless %}
{% endblock sonata_media_photo_view_type_widget %}