Skip to content

Kirby 3.6.6

gallery

A list of images to create galleries of all sorts

Preview

Default files

Snippet

<?php /** @var \Kirby\Cms\Block $block */ ?>
<figure>
  <ul>
    <?php foreach ($block->images()->toFiles() as $image): ?>
    <li>
      <?= $image ?>
    </li>
    <?php endforeach ?>
  </ul>
</figure>

To overwrite this default snippet, place your custom file in /site/snippets/blocks/gallery.php.

Blueprint

name: field.blocks.gallery.name
icon: dashboard
preview: gallery
fields:
  images:
    label: field.blocks.gallery.images.label
    type: files
    query: model.images
    multiple: true
    layout: cards
    size: tiny
    empty: field.blocks.gallery.images.empty
    uploads:
      template: blocks/image
    image:
      ratio: 1/1

To overwrite this default blueprint, place your custom file in /site/blueprints/blocks/gallery.yml.

Vue component

kirby/blob/main/panel/src/components/Forms/Blocks/Types/Gallery.vue