Hi, i am trying to retrieve the URL of the first few images of a page to preload them. Those images are in a structure in a block in a layout.
So I have a page with layout with blocks and a block called teaser:
name: Teaser
fields:
items:
type: structure
fields:
image:
Now I would like to get the image urls from the first teaser block on the page.
I tried iterating through the layouts columns and blocks, but it seemed very complicated. Is there a more straightforward way?
Something like:
$items = $page->layout()->toLayouts()->columns()->blocks()->filterBy('type', 'teaser')->first()->items();
foreach ($items as $item) {
// $item->image()->link()
}
Thanks, Mathis