andreaballerino
5/25/2018 - 4:28 PM

Kirby CMS - Image in Structure Field

# Fields
fields:
  gallery:
    label: Galeria
    help: Description...
    type: structure
    entry: >
      {{galleryimage}}
    fields:
      galleryimage:
        label: Image 
        type: image
<div class="slider">

  <?php foreach($page->gallery()->toStructure() as $gallery): ?>

    <?php if($image = $gallery->galleryimage()->toFile()): ?>

    <div class="slider-item">
      <div class="slider-image" style="background-image: url(<?php echo $image->url() ?>)"></div>
    </div><!-- /slider-item -->

    <?php endif ?>

  <?php endforeach ?>

</div><!-- /slider -->