123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- {#
- This file is part of the Sonata package.
- (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.
- #}
- {# Labels #}
- {% block generic_label %}
- {% spaceless %}
- {% if required %}
- {% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
- {% endif %}
- {% if in_list_checkbox is defined and in_list_checkbox and widget is defined %}
- <label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>
- {{ widget|raw }}
- <span>
- {% if not sonata_admin.admin%}
- {{- label -}}
- {% else %}
- {{- label|trans({}, sonata_admin.admin.translationDomain) -}}
- {% endif%}
- </span>
- </label>
- {% else %}
- <label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>
- {% if not sonata_admin.admin%}
- {{ label }}
- {% else %}
- {{ label|trans({}, sonata_admin.admin.translationDomain) }}
- {% endif%}
- {{ required ? '*' : '' }}
- </label>
- {% endif %}
- {% endspaceless %}
- {% endblock %}
- {% block widget_container_attributes_choice_widget %}
- {% spaceless %}
- id="{{ id }}"
- {% for attrname,attrvalue in attr %}{{attrname}}="{% if attrname == 'class' %}inputs-list {% endif%}{{attrvalue}}" {% endfor %}
- {% if "class" not in attr|keys %}class="inputs-list"{%endif %}
- {% endspaceless %}
- {% endblock %}
- {% block choice_widget %}
- {% spaceless %}
- {% if expanded %}
- <ul {{ block('widget_container_attributes_choice_widget') }}>
- {% for child in form %}
- <li>
- {{ form_label(child, null, { 'in_list_checkbox' : true, 'widget' : form_widget(child) } ) }}
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
- {% if empty_value is not none %}
- <option value="">{{ empty_value|trans }}</option>
- {% endif %}
- {% if preferred_choices|length > 0 %}
- {% set options = preferred_choices %}
- {{ block('widget_choice_options') }}
- {% if choices|length > 0 %}
- <option disabled="disabled">{{ separator }}</option>
- {% endif %}
- {% endif %}
- {% set options = choices %}
- {{ block('widget_choice_options') }}
- </select>
- {% endif %}
- {% endspaceless %}
- {% endblock choice_widget %}
- {% block field_row %}
- {% if sonata_admin is not defined or not sonata_admin_enabled or not sonata_admin.field_description %}
- {{ parent() }}
- {% else %}
- <div class="clearfix{% if errors|length > 0%} error{%endif%}" id="sonata-ba-field-container-{{ id }}">
- {% block label %}
- {% if sonata_admin.field_description.options.name is defined %}
- {{ form_label(form, sonata_admin.field_description.options.name) }}
- {% else %}
- {{ form_label(form) }}
- {% endif %}
- {% endblock %}
- <div class="input sonata-ba-field sonata-ba-field-{{ sonata_admin.edit }}-{{ sonata_admin.inline }} {% if errors|length > 0 %}sonata-ba-field-error{% endif %}">
- {{ form_widget(form) }}
- {% if sonata_admin.field_description.help %}
- <span class="help-block sonata-ba-field-help">{{ sonata_admin.field_description.help }}</span>
- {% endif %}
- {% if errors|length > 0 %}
- <div class="sonata-ba-field-error-messages">
- {{ form_errors(form) }}
- </div>
- {% endif %}
- </div>
- </div>
- {% endif %}
- {% endblock field_row %}
- {% block collection_widget_row %}
- {% spaceless %}
- <div class="sonata-collection-row">
- {% if allow_delete %}
- <a href="#" class="sonata-collection-delete"></a>
- {% endif %}
- {{ form_row(child) }}
- </div>
- {% endspaceless %}
- {% endblock %}
- {% block collection_widget %}
- {% spaceless %}
- {% if prototype is defined %}
- {% set child = prototype %}
- {% set attr = attr|merge({'data-prototype': block('collection_widget_row') }) %}
- {% endif %}
- <div {{ block('widget_container_attributes') }}>
- {{ form_errors(form) }}
- {% for child in form %}
- {{ block('collection_widget_row') }}
- {% endfor %}
- {{ form_rest(form) }}
- {% if allow_add %}
- <div><a href="#" class="sonata-collection-add"></a></div>
- {% endif %}
- </div>
- {% endspaceless %}
- {% endblock collection_widget %}
|