Selecting images from another page

Thanks, I was already looking at that, and seem to have sussed it out.

Not sure if this will help anyone else in the future, but I’ve updated the file controllers/album.php to the below, and all seems to be working as expected.

return function ($page) {

    $gallery = $page->content()->get('images')->toFiles()->sortBy('sort', 'filename');

    return [
        'gallery' => $gallery
    ];

};

For completeness, this is the corresponding field from the album.yml blueprint:

    fields:
      images:
        type: files
        layout: cards
        size: medium
        template: gallery-image
        info: "{{ file.dimensions }}"
        image:
          ratio: 5/4
          cover: true
        options: query
        query: site.find('gallery').images
        uploads: 
            parent: site.find('gallery')
            template: gallery-image

Thanks for your help!

1 Like