You are here

slick-slide.html.twig in Slick Carousel 8

Same filename and directory in other branches
  1. 8.2 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. {% set slide %}
  35. {% block slick_slide %}
  36. {% if settings.split and not settings.unslick %}
  37. <div class="slide__media">{{ item.slide }}</div>
  38. {% else %}
  39. {{ item.slide }}
  40. {% endif %}
  41. {% endblock %}
  42. {% endset %}
  43. {% if settings.wrapper %}
  44. <div{{ attributes.addClass(classes) }}>
  45. {% if settings.grid is empty %}<div{{ content_attributes.addClass(content_classes) }}>{% endif %}
  46. {% endif %}
  47. {% if item.slide %}
  48. {{ slide }}
  49. {% endif %}
  50. {% if item.caption %}
  51. {% block slick_caption %}
  52. {% if settings.fullwidth %}<div class="slide__constrained">{% endif %}
  53. <div class="slide__caption">
  54. {% if item.caption.overlay %}
  55. <div class="slide__overlay">{{ item.caption.overlay }}</div>
  56. {% if settings.data %}<div class="slide__data">{% endif %}
  57. {% endif %}
  58. {% if item.caption.title %}
  59. <h2 class="slide__title">{{ item.caption.title }}</h2>
  60. {% endif %}
  61. {% if item.caption.alt %}
  62. <p class="slide__description">{{ item.caption.alt }}</p>
  63. {% endif %}
  64. {{ item.caption.data }}
  65. {% if item.caption.link %}
  66. <div class="slide__link">{{ item.caption.link }}</div>
  67. {% endif %}
  68. {% if item.caption.overlay and settings.data %}</div>{% endif %}
  69. </div>
  70. {% if settings.fullwidth %}</div>{% endif %}
  71. {% endblock %}
  72. {% endif %}
  73. {% if settings.wrapper %}
  74. {% if settings.grid is empty %}</div>{% endif %}
  75. </div>
  76. {% endif %}