You are here

field-slideshow.html.twig in Field Slideshow 8.2

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