socialbase-1.1.0/templates/comment/field--field-comment-files.html.twig
templates/comment/field--field-comment-files.html.twig
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
*
* @see template_preprocess_field()
*/
#}
{# Fields in the event teaser need to render without a div, because it is a child element of a tag that cannot have a div such as an anchor or paragraph #}
{{ attach_library('socialbase/photoswipe.image') }}
{%
set classes = [
'field',
'field--item',
]
%}
<div class="photoswipe-gallery-custom" itemscope itemtype="http://schema.org/ImageGallery">
{% for item in items %}
{% if item.content['#item'].is_image %}
<div{{ attributes.addClass(classes) }}>
<a class="photoswipe-item" href="{{ file_url(item.content['#item'].entity.uri.value) }}"
data-med="{{ file_url(item.content['#item'].entity.uri.value) }}"
data-med-size="{{ item.content['#item'].width }}x{{ item.content['#item'].height }}"
data-size="{{ item.content['#item'].width }}x{{ item.content['#item'].height }}">
{{ item.content }}
</a>
</div>
{% else %}
<div {{ attributes.addClass(classes, 'field--item--file') }}>
{{ item.content }}
{# Remove the class from the loop again. So we don't pass it on. #}
{{ attributes.removeClass(classes, 'field--item--file') }}
</div>
{% endif %}
{% endfor %}
</div>
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button>
<div class="pswp__caption">
<div class="pswp__caption__center">
</div>
</div>
</div>
</div>
</div>
