bootstrap_components_toolkit-1.0.0/templates/bootstrap-figure.html.twig
templates/bootstrap-figure.html.twig
{#
/**
* @file
* Template for a Bootstrap Figure component.
*
* It behaves as a regular HTML5 figure with optional figcaption, and allows
* some bootstrap config to be passed (rounded corners, fluid, image)
*
* Available config:
* - image_url: The url of the image asset to be rendered
* - caption: Optionally, the caption of the image
* - rounded: Wether to output rounded corners.
* - caption_alignment: Optionally, the alignment of the caption text
*/
#}
{% set image_classes = [
'figure-img',
'img-fluid',
rounded ? 'rounded',
] %}
{% set caption_classes = [
'figure-caption',
caption_alignment == 'end' ? 'text-end'
] %}
<figure class="figure">
{% block image %}
<img{{ create_attribute({ class : image_classes }) }} src="{{ image_url }}" >
{% endblock %}
{% if caption %}
<figcaption{{create_attribute({class:caption_classes})}}>{{ caption }}</figcaption>
{% endif %}
</figure>
