Add styles for the gallery

This commit is contained in:
Bastian Allgeier
2023-12-05 13:03:59 +01:00
parent c37ec66ab6
commit 122d28dbcb
4 changed files with 64 additions and 34 deletions

View File

@@ -0,0 +1,23 @@
<?php
/** @var \Kirby\Cms\Block $block */
?>
<figure class="gallery">
<ul>
<?php foreach ($block->images()->toFiles() as $image): ?>
<li>
<?php snippet('image', [
'alt' => $image->alt(),
'contain' => $block->crop()->isTrue(),
'lightbox' => true,
'ratio' => $block->ratio()->or('auto'),
'src' => $image->url(),
]) ?>
</li>
<?php endforeach ?>
</ul>
<?php if ($block->caption()->isNotEmpty()): ?>
<figcaption>
<?= $block->caption() ?>
</figcaption>
<?php endif ?>
</figure>