file image-widget.html.twig

Theme override for an image field widget.

Available variables:

  • attributes: HTML attributes for the containing element.
  • data: Render elements of the image widget.

See Also

  • template_preprocess_image_widget()
Source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for an image field widget.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the containing element.
  8. * - data: Render elements of the image widget.
  9. *
  10. * @ingroup templates
  11. *
  12. * @see template_preprocess_image_widget()
  13. */
  14. #}
  15. {% if data.preview %}
  16. <div{{ attributes.addClass('row') }}>
  17. <div class="preview col-sm-2">
  18. {{ data.preview }}
  19. </div>
  20. <div class="data col-sm-10">
  21. {# Render widget data without the image preview that was output already. #}
  22. {{ data|without('preview') }}
  23. </div>
  24. </div>
  25. {% else %}
  26. <div{{ attributes.addClass(classes) }}>
  27. {{ data }}
  28. </div>
  29. {% endif %}

Related topics