ok, this get’s the first file in the page folder. You can remove that.
This line should actually return a string, i.e. the Url to the file, but seems to return an array.
could you please, with the echoes $src variable removed do a
dump($src)
So that we can see what this returns.
Kirby\Cms\Field Object
(
[model] => Array
(
)
)
Ok, then please do the following:
dump($block->model());
and
dump($block->model()->toFile());
Ok I don’t know what happened but it works now.
if($model = $block->model()->toFile()) {$src = $model->url();};
Thank you Sonja!
Cool, have a great weekend!