image-widget.html.twig in Open Social 8.8
Same filename and directory in other branches
- 8.9 themes/socialbase/templates/file/image-widget.html.twig
 - 8 themes/socialbase/templates/file/image-widget.html.twig
 - 8.2 themes/socialbase/templates/file/image-widget.html.twig
 - 8.3 themes/socialbase/templates/file/image-widget.html.twig
 - 8.4 themes/socialbase/templates/file/image-widget.html.twig
 - 8.5 themes/socialbase/templates/file/image-widget.html.twig
 - 8.6 themes/socialbase/templates/file/image-widget.html.twig
 - 8.7 themes/socialbase/templates/file/image-widget.html.twig
 
Default theme implementation for an image field widget.
Available variables:
- attributes: HTML attributes for the containing element.
 - data: Render elements of the image widget.
 
See also
File
themes/socialbase/templates/file/image-widget.html.twigView source
- {#
 - /**
 -  * @file
 -  * Default theme implementation for an image field widget.
 -  *
 -  * Available variables:
 -  * - attributes: HTML attributes for the containing element.
 -  * - data: Render elements of the image widget.
 -  *
 -  * @see template_preprocess_image_widget()
 -  *
 -  * @ingroup themeable
 -  */
 - #}
 - 
 - {{ attach_library('socialbase/image-widget') }}
 - {{ attach_library('image_widget_crop/cropper') }}
 - {% set in_post = data.upload['#id'] starts with "edit-field-post-image-0-upload" %}
 - 
 - {% if data.preview %}
 -   <div{{ attributes.addClass('image-widget').removeClass('clearfix') }}>
 -     <div class="preview">
 -       {{ data.preview }}
 -     </div>
 -     <div class="data image-widget-data">
 - 
 -       {% if in_post %}
 -         {# Render widget data for photo's in posts without the file fields, image preview and remove button. #}
 -         {{ data|without('preview', 'image_crop', 'file_' ~ data.fids['#value'][0], 'remove_button' ) }}
 -       {% else %}
 -         {# Render widget data without the image preview that was output already. #}
 -         {{ data|without('preview', 'image_crop') }}
 -       {% endif %}
 - 
 -     </div>
 -   </div>
 - 
 -   {% if in_post %}
 -     {# Render a "fake" remove button that triggers the actual (hidden) remove button. #}
 -     <div class="hidden">{{ data.remove_button }}</div>
 -     <button type="button" id="post-photo-remove" class="btn--post-remove-image">
 -       <svg class="btn-icon">
 -         <title>{% trans %}Remove image{% endtrans %}</title>
 -         <use id="btnicon" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-close"></use>
 -       </svg>
 -     </button>
 - 
 -   {% else %}
 - 
 -     {{ data.image_crop }}
 - 
 -   {% endif %}
 - 
 - {% else %}
 - 
 -   {% if in_post %}
 - 
 -     {# Render a "fake" image add button that triggers the actual (hidden) upload field. #}
 -     <div{{ attributes.addClass(classes, 'hidden') }}>
 -       {{ data }}
 -     </div>
 -     <button type="button" id="post-photo-add" class="btn btn-default">
 -       <svg class="btn-icon" aria-hidden="true">
 -         <use id="btnicon" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-plus"></use>
 -       </svg>
 -       <span>
 -         {% trans %}Add image{% endtrans %}
 -       </span>
 -     </button>
 - 
 -   {% else %}
 - 
 -     <div{{ attributes.addClass(classes) }}>
 -       {{ data }}
 -     </div>
 - 
 -   {% endif %}
 - 
 - {% endif %}