You are here

field-slideshow.html.twig in Field Slideshow 8

Template file for field_slideshow

File

templates/field-slideshow.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template file for field_slideshow
  5. *
  6. *
  7. */#}
  8. {%
  9. set classes = [
  10. 'field-slideshow-' ~ slideshow_id,
  11. 'effect-' ~ js_variables.fx,
  12. 'timeout-' ~ js_variables.timeout,
  13. pager is defined and pager != '' ? 'with-pager',
  14. controls is defined ? 'with-controls'
  15. ]
  16. %}
  17. {% if controls_position is not defined %}
  18. {% set controls_position = "after" %}
  19. {% endif %}
  20. {% if pager_position is not defined %}
  21. {% set pager_position = "after" %}
  22. {% endif %}
  23. <div id="field-slideshow-{{ slideshow_id }}-wrapper" class="field-slideshow-wrapper">
  24. {% if controls_position == 'before' %}
  25. {{ controls }}
  26. {% endif %}
  27. {% if pager_position == 'before' %}
  28. {{ pager }}
  29. {% endif %}
  30. {% if breakpoints is defined and breakpoints.mapping is defined and breakpoints.mapping is not empty %}
  31. {% set style = 'height:' ~ slides_max_height ~ 'px' %}
  32. {% else %}
  33. {% set style = 'width:' ~ slides_max_width ~ 'px; height:' ~ slides_max_height ~ 'px' %}
  34. {% endif %}
  35. <div{{ attributes.addClass(classes).setAttribute('style', style) }}>
  36. {% for num,item in items %}
  37. {% set itemVal = item.getValue() %}
  38. {%
  39. set classes = [
  40. 'field-slideshow-slide',
  41. 'field-slideshow-slide-' ~ (1+num)
  42. ]
  43. %}
  44. {% set style = (num) ? 'display:none' %}
  45. <div class="field-slideshow-slide field-slideshow-slide-{{1+num}} {{slide[num]['classes']}}" style="{{style}}">
  46. {% if colorbox_img_path[num]['path'] is not empty and image_url == '' %}
  47. <a href="{{ colorbox_img_path[num]['path'] }}" {{ colorbox_attributes[num] }}>
  48. {{ image[num] }}
  49. </a>
  50. {% elseif fc_url is not empty %}
  51. <a href="{{ fc[num]['path'] }}">
  52. {{ image[num] }}
  53. </a>
  54. {% else %}
  55. {{ image[num] }}
  56. {% endif %}
  57. {% if itemVal['caption'] is defined and itemVal['caption'] != '' %}
  58. <div class="field-slideshow-caption">
  59. {% if itemVal['caption_path'] != '' %}
  60. <span class="field-slideshow-caption-text">
  61. {{ link(itemVal['caption'], itemVal['caption_path']) }}
  62. </span>
  63. {% else %}
  64. <span class="field-slideshow-caption-text">
  65. {{ itemVal['caption'] }}
  66. </span>
  67. {% endif %}
  68. </div>
  69. {% endif %}
  70. </div>
  71. {% endfor %}
  72. </div>
  73. {% if controls_position != "before" %}
  74. {{ controls }}
  75. {% endif %}
  76. {% if pager_position != "before" %}
  77. {{ pager }}
  78. {% endif %}
  79. </div>