form.html.twig 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {% extends "TwigBundle::form.html.twig" %}
  2. {% block field_row %}
  3. <div class="symfony-form-row">
  4. {{ form_label(child) }}
  5. <div class="symfony-form-field">
  6. {{ form_field(child) }}
  7. <div class="symfony-form-errors">
  8. {{ form_errors(child) }}
  9. </div>
  10. </div>
  11. </div>
  12. {% endblock %}
  13. {% block label %}
  14. <label for="{{ field.id }}">
  15. {% trans label %}
  16. {% if field.required %}
  17. <span class="symfony-form-required" title="This field is required">*</span>
  18. {% endif %}
  19. </label>
  20. {% endblock label %}
  21. {% block errors %}
  22. {% if field.hasErrors %}
  23. <ul>
  24. {% for error in field.errors %}
  25. <li>{% trans error.messageTemplate with error.messageParameters from 'validators' %}</li>
  26. {% endfor %}
  27. </ul>
  28. {% endif %}
  29. {% endblock errors %}
  30. {% block text_field %}
  31. {% if attr.type is defined and attr.type != "text" %}
  32. <input {{ block('field_attributes') }} value="{{ field.displayedData }}" />
  33. {% else %}
  34. {% set attr = attr|merge({ 'maxlength': attr.maxlength|default(field.maxlength) }) %}
  35. <input type="text" {{ block('field_attributes') }} value="{{ field.displayedData }}" />
  36. {% endif %}
  37. {% endblock text_field %}
  38. {% block password_field %}
  39. {% set attr = attr|merge({ 'maxlength': attr.maxlength|default(field.maxlength) }) %}
  40. <input type="password" {{ block('field_attributes') }} class="medium_txt" value="{{ field.displayedData }}" />
  41. {% endblock password_field %}