You are here

bootstrap-basic-image-gallery.html.twig in Bootstrap Basic Image Gallery 8

Default implementation for bootstrap basic image gallery.

Available variables:

  • main: main image.
  • thumbnails: thumbnail images.
  • lazyload: the class for lazyloading.
  • modal: array containing variables for rendering the modal
  • carousel: array containing variables for rendering the carousel

File

templates/bootstrap-basic-image-gallery.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default implementation for bootstrap basic image gallery.
  5. *
  6. * Available variables:
  7. * - main: main image.
  8. * - thumbnails: thumbnail images.
  9. * - lazyload: the class for lazyloading.
  10. * - modal: array containing variables for rendering the modal
  11. * - carousel: array containing variables for rendering the carousel
  12. *
  13. * @ingroup themeable
  14. */
  15. #}
  16. <div class="bootstrap-basic-image-gallery">
  17. <div class="main-image" data-toggle="modal" data-slide-to="0" data-target="#{{ modal.id }}">{{ main }}</div>
  18. {% if thumbnails.images|length > 1 %}
  19. <div class="thumbnails">
  20. {% for key,image in thumbnails.images %}
  21. <div class="thumb {{ thumbnails.class }}" style="width:{{ thumbnails.width }}%;" data-toggle="modal" data-slide-to="{{ key }}" data-target="#{{ modal.id }}">
  22. {{ image }}
  23. </div>
  24. {% endfor %}
  25. </div>
  26. {% endif %}
  27. <div class="modal fade carousel slide {{ lazyload }}" id="{{ modal.id }}" tabindex="-1" role="dialog" aria-labelledby="{{ modal.id }}-title" aria-hidden="true">
  28. <div class="modal-dialog" role="document">
  29. <div class="modal-content">
  30. <div class="modal-header">
  31. <h5 class="modal-title" id="{{ modal.id }}-title">{{ modal.label }}</h5>
  32. <button class="close btn btn-default" data-dismiss="modal" value="&times;"><span aria-hidden="true">×</span></button>
  33. </div>
  34. <div class="modal-body">
  35. <div id="{{ carousel.id }}" class="carousel slide {{ lazyload }}" data-interval="{{ carousel.interval }}" data-ride="{{ carousel.autoplay }}">
  36. <div class="carousel-inner" role="listbox">
  37. {% for key,carousel_image in carousel.images %}
  38. <div class="carousel-item item slide-{{key}} {% if loop.first %}active{% endif %}">
  39. {{ carousel_image }}
  40. <div class="carousel-caption">{{ attribute(carousel_image, '#caption') }}</div>
  41. </div>
  42. {% endfor %}
  43. {% if thumbnails.images|length > 1 %}
  44. <a class="carousel-control-prev left carousel-control" href="#{{ carousel.id }}" role="button" data-slide="prev">
  45. <span class="carousel-control-prev-icon icon-prev"></span>
  46. <span class="sr-only">{% trans %}Previous{% endtrans %}</span>
  47. </a>
  48. <a class="carousel-control-next right carousel-control" href="#{{ carousel.id }}" role="button" data-slide="next">
  49. <span class="carousel-control-next-icon icon-next"></span>
  50. <span class="sr-only">{% trans %}Next{% endtrans %}</span>
  51. </a>
  52. {% endif %}
  53. </div>
  54. {% if thumbnails.images|length > 1 %}
  55. <ol class="carousel-indicators">
  56. {% for index in 0..(carousel.images|length -1) %}
  57. <li data-target="#{{ carousel.id }}" data-slide-to="{{ index }}" class="{% if loop.first %}active{% endif %}"></li>
  58. {% endfor %}
  59. </ol>
  60. {% endif %}
  61. </div>
  62. </div>
  63. <div class="modal-footer">
  64. <button class="btn btn-secondary" data-dismiss="modal" value="Close">{% trans %}Close{% endtrans %}</button>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>