You are here

slick-slide.html.twig in Slick Carousel 8.2

Same filename and directory in other branches
  1. 8 templates/slick-slide.html.twig

Default theme implementation for the individual slick item/slide template.

Available variables:

  • attributes: An array of attributes to apply to the element.
  • item.slide: A renderable array of the main image/background.
  • item.caption: A renderable array containing caption fields if provided:
    • title: The individual slide title.
    • alt: The core Image field Alt as caption.
    • link: The slide links or buttons.
    • overlay: The image/audio/video overlay, or a nested slick.
    • data: any possible field for more complex data if crazy enough.
  • settings: An array containing the given settings.

File

templates/slick-slide.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for the individual slick item/slide template.
  5. *
  6. * Available variables:
  7. * - attributes: An array of attributes to apply to the element.
  8. * - item.slide: A renderable array of the main image/background.
  9. * - item.caption: A renderable array containing caption fields if provided:
  10. * - title: The individual slide title.
  11. * - alt: The core Image field Alt as caption.
  12. * - link: The slide links or buttons.
  13. * - overlay: The image/audio/video overlay, or a nested slick.
  14. * - data: any possible field for more complex data if crazy enough.
  15. * - settings: An array containing the given settings.
  16. *
  17. * @see template_preprocess_slick_slide()
  18. */
  19. #}
  20. {%
  21. set classes = [
  22. 'slick__slide', 'slide', 'slide--' ~ delta,
  23. item.slide is empty ? 'slide--text',
  24. settings.layout ? 'slide--caption--' ~ settings.layout|clean_class,
  25. settings.class ? settings.class
  26. ]
  27. %}
  28. {%
  29. set content_classes = [
  30. settings.detroy ? 'slide',
  31. not settings.detroy ? 'slide__content'
  32. ]
  33. %}
  34. {%
  35. set caption_classes = [
  36. 'slide__caption',
  37. ]
  38. %}
  39. {% set slide %}
  40. {% block slick_slide %}
  41. {% if settings.split and not settings.unslick %}
  42. <div class="slide__media">{{ item.slide }}</div>
  43. {% else %}
  44. {{ item.slide }}
  45. {% endif %}
  46. {% endblock %}
  47. {% endset %}
  48. {% if settings.wrapper %}
  49. <div{{ attributes.addClass(classes) }}>
  50. {% if settings.grid is empty %}<div{{ content_attributes.addClass(content_classes) }}>{% endif %}
  51. {% endif %}
  52. {% if item.slide %}
  53. {{ slide }}
  54. {% endif %}
  55. {% if item.caption %}
  56. {% block slick_caption %}
  57. {% if settings.fullwidth %}<div class="slide__constrained">{% endif %}
  58. <div{{ caption_attributes.addClass(caption_classes) }}>
  59. {% if item.caption.overlay %}
  60. <div class="slide__overlay">{{ item.caption.overlay }}</div>
  61. {% if settings.data %}<div class="slide__data">{% endif %}
  62. {% endif %}
  63. {% if item.caption.title %}
  64. <h2 class="slide__title">{{ item.caption.title }}</h2>
  65. {% endif %}
  66. {% if item.caption.alt %}
  67. <p class="slide__description">{{ item.caption.alt }}</p>
  68. {% endif %}
  69. {% if item.caption.data %}
  70. <div class="slide__description">{{ item.caption.data }}</div>
  71. {% endif %}
  72. {% if item.caption.link %}
  73. <div class="slide__link">{{ item.caption.link }}</div>
  74. {% endif %}
  75. {% if item.caption.overlay and settings.data %}</div>{% endif %}
  76. </div>
  77. {% if settings.fullwidth %}</div>{% endif %}
  78. {% endblock %}
  79. {% endif %}
  80. {% if settings.wrapper %}
  81. {% if settings.grid is empty %}</div>{% endif %}
  82. </div>
  83. {% endif %}