Add styles for the gallery
This commit is contained in:
23
site/snippets/blocks/gallery.php
Normal file
23
site/snippets/blocks/gallery.php
Normal 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>
|
Reference in New Issue
Block a user