You are here

bootstrap--simple--carousel--block.html.twig in bootstrap simple carousel 8

{%
    set classes = [
    'block',
    'block-' ~ configuration.provider|clean_class,
    'block-bootstrap-simple-carousel',
]
%}
<div{{ attributes.addClass(classes) }}>
    {{ title_prefix }}
    {% if label %}
        <h2{{ title_attributes.addClass('visually-hidden') }}>{{ label }}</h2>
    {% endif %}
    {{ title_suffix }}
    {% block content %}
        <div
            id="carousel-block-generic"
            class="carousel slide"
            data-ride="carousel"
            data-wrap="{% if settings.get('wrap') == 1  %}true{% else %}false{% endif %}"
            data-interval="{{ settings.get('interval') }}"
            data-pause="{% if settings.get('pause')  %}hover{% endif %}"
        >
            <!-- Indicators -->
            {% if settings.get('indicators')  %}
                <ol class="carousel-indicators">
                    {% for item in items %}
                        <li
                            data-target="#carousel-block-generic" data-slide-to="{{ loop.index - 1 }}"
                            class="indicator-item{{ loop.first ? ' active' : '' }}">
                        </li>
                    {% endfor %}
                </ol>
            {% endif %}

            <!-- Wrapper for slides -->
            <div class="carousel-inner">
                {% for item in items %}
                    <div class="carousel-item item{{ loop.first ? ' active' : '' }}">
                        {% if item.image_link is not empty %}
                            <a href="{{ item.image_link }}">
                        {% endif %}
                            <img
                                    src="{{ item.image_url }}"
                                    class="carousel-image {{ settings.get('image_type') }}"
                                    alt="{{ item.image_alt }}"
                                    title="{{ item.image_title }}"
                            >
                        {% if item.image_link is not empty %}
                            </a>
                        {% endif %}
                        <div class="carousel-caption">
                            {% if item.caption_title  %}<h3> {{ item.caption_title }} </h3>{% endif %}
                            {% if item.caption_text  %}<p> {{ item.caption_text }} </p>{% endif %}
                        </div>
                    </div>
                {% endfor %}
            </div>

            <!-- Controls -->
            {% if settings.get('controls')  %}
                <a class="left carousel-control carousel-control-prev" href="#carousel-block-generic" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left carousel-control-prev-icon"></span>
                </a>
                <a class="right carousel-control carousel-control-next" href="#carousel-block-generic" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right carousel-control-next-icon"></span>
                </a>
            {% endif %}
        </div>
    {% endblock %}
</div>

File

templates/bootstrap--simple--carousel--block.html.twig
View source
  1. {%
  2. set classes = [
  3. 'block',
  4. 'block-' ~ configuration.provider|clean_class,
  5. 'block-bootstrap-simple-carousel',
  6. ]
  7. %}
  8. <div{{ attributes.addClass(classes) }}>
  9. {{ title_prefix }}
  10. {% if label %}
  11. <h2{{ title_attributes.addClass('visually-hidden') }}>{{ label }}</h2>
  12. {% endif %}
  13. {{ title_suffix }}
  14. {% block content %}
  15. <div
  16. id="carousel-block-generic"
  17. class="carousel slide"
  18. data-ride="carousel"
  19. data-wrap="{% if settings.get('wrap') == 1 %}true{% else %}false{% endif %}"
  20. data-interval="{{ settings.get('interval') }}"
  21. data-pause="{% if settings.get('pause') %}hover{% endif %}"
  22. >
  23. <!-- Indicators -->
  24. {% if settings.get('indicators') %}
  25. <ol class="carousel-indicators">
  26. {% for item in items %}
  27. <li
  28. data-target="#carousel-block-generic" data-slide-to="{{ loop.index - 1 }}"
  29. class="indicator-item{{ loop.first ? ' active' : '' }}">
  30. </li>
  31. {% endfor %}
  32. </ol>
  33. {% endif %}
  34. <!-- Wrapper for slides -->
  35. <div class="carousel-inner">
  36. {% for item in items %}
  37. <div class="carousel-item item{{ loop.first ? ' active' : '' }}">
  38. {% if item.image_link is not empty %}
  39. <a href="{{ item.image_link }}">
  40. {% endif %}
  41. <img
  42. src="{{ item.image_url }}"
  43. class="carousel-image {{ settings.get('image_type') }}"
  44. alt="{{ item.image_alt }}"
  45. title="{{ item.image_title }}"
  46. >
  47. {% if item.image_link is not empty %}
  48. </a>
  49. {% endif %}
  50. <div class="carousel-caption">
  51. {% if item.caption_title %}<h3> {{ item.caption_title }} </h3>{% endif %}
  52. {% if item.caption_text %}<p> {{ item.caption_text }} </p>{% endif %}
  53. </div>
  54. </div>
  55. {% endfor %}
  56. </div>
  57. <!-- Controls -->
  58. {% if settings.get('controls') %}
  59. <a class="left carousel-control carousel-control-prev" href="#carousel-block-generic" data-slide="prev">
  60. <span class="glyphicon glyphicon-chevron-left carousel-control-prev-icon"></span>
  61. </a>
  62. <a class="right carousel-control carousel-control-next" href="#carousel-block-generic" data-slide="next">
  63. <span class="glyphicon glyphicon-chevron-right carousel-control-next-icon"></span>
  64. </a>
  65. {% endif %}
  66. </div>
  67. {% endblock %}
  68. </div>