Closed dannyuk1982 closed 2 months ago
Something weird happens when using an asset tag with :url= syntax when using as= on the collection tag.
So this code works:
{{ collection from="blog" }} {{ asset :url="thumbnail_image" }} {{ url }}<br> {{ /asset }} {{ /collection }}
This doesn't (adding in as="posts")
{{ collection from="blog" as="posts" }} {{ posts }} {{ asset :url="thumbnail_image" }} {{ url }}<br> {{ /asset }} {{ /posts }} {{ /collection }}
Error: Statamic\Assets\AssetRepository::find(): Argument #1 ($asset) must be of type string, null given
Statamic\Assets\AssetRepository::find(): Argument #1 ($asset) must be of type string, null given
However this does work
{{ collection from="blog" as="posts" }} {{ posts }} {{ asset url="{thumbnail_image}" }} {{ url }}<br> {{ /asset }} {{ /posts }} {{ /collection }}
Not a biggie as it works with the url="{foo}", but I guess it should work with the :url="foo"syntax too.
No response
Statamic 5.17
Fresh statamic/statamic site via CLI
Weird that it doesn't happen without the as but it might be because one of the entries in the loop doesn't have a thumbnail_image.
as
thumbnail_image
Yea, there are a couple of don't have thumbnail_image set to anything.
Bug description
Something weird happens when using an asset tag with :url= syntax when using as= on the collection tag.
How to reproduce
So this code works:
This doesn't (adding in as="posts")
Error:
Statamic\Assets\AssetRepository::find(): Argument #1 ($asset) must be of type string, null given
However this does work
Not a biggie as it works with the url="{foo}", but I guess it should work with the :url="foo"syntax too.
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response