field.html.twig 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {% block field %}
  2. <div class="form-field {{ layout_form_field_outer_classes|trim -}} {{- form_field_outer_core|trim -}}">
  3. {% block contents %}
  4. {% if show_label %}
  5. <div class="{{- layout_form_field_outer_label_classes -}}">
  6. {{- form_field_toggleable -}}
  7. <label class="{{ layout_form_field_label_classes }}{{ form_field_label_trim }}" {% if field.id %}for="{{ form_field_for }}"{% endif %}>
  8. {%- block label -%}
  9. {%- if form_field_help -%}
  10. <span class="tooltip" data-tooltip="{{ form_field_help|e }}">{{ form_field_label|raw }}</span>
  11. {%- else -%}
  12. {{ form_field_label|raw }}
  13. {%- endif -%}
  14. {%- if form_field_required %}
  15. <span class="required">*</span>
  16. {%- endif -%}
  17. {%- endblock -%}
  18. </label>
  19. </div>
  20. {% endif %}
  21. <div class="{{ layout_form_field_outer_data_classes }}"
  22. {% block global_attributes %}{% endblock %}
  23. >
  24. {% block group %}
  25. {% block input %}
  26. <div class="{{ layout_form_field_wrapper_classes }} {{ field.size }}">
  27. {% block prepend %}{% endblock prepend %}
  28. <input
  29. name="{{ (scope ~ field.name)|fieldName }}"
  30. value="{{ value|join(', ')|e }}"
  31. {% block input_attributes %}{% endblock %}
  32. />
  33. {% block append %}{% endblock append %}
  34. {% if inline_errors and errors %}
  35. <div class="{{ form_field_inline_error_classes }}">
  36. <p class="form-message"><i class="fa fa-exclamation-circle"></i> {{ errors|first|raw }}</p>
  37. </div>
  38. {% endif %}
  39. </div>
  40. {% endblock %}
  41. {% endblock %}
  42. {% if field.description is defined %}
  43. <div class="{{ form_field_extra_wrapper_classes }}">
  44. <span class="form-description">
  45. {{ form_field_description|raw }}
  46. </span>
  47. </div>
  48. {% endif %}
  49. </div>
  50. {% endblock %}
  51. </div>
  52. {% endblock %}