[5.x] resolve modifier#11890
Conversation
|
I've been using a custom |
Yeah, if you provide a key, the result is searched for that. If you dont provide a key, an array of all results is returned. |
|
Oh, didn't know |
|
I wonder if the better thing to do might be to revert returning query builders at all, and always return resolved values. Then there could be a modifier to get the query builder for the (rare) times you really want that. It would simplify things greatly. |
|
Yeah, I agree. But the ability to grab an item by index from a collection or array and pass that into other modifiers would still be nice (and not possible until now?). |
yaaaassss plz fren |
I was missing the ability to get, for example, the first asset from an asset field (
{{ asset_field | resolve(0) }}) or having a modifier to get a specific index from an array or a collection.I was trying to extend the
getmodifier (#11889), but ran into some logical conflicts when providing a specific index for arrays. Therefore, I decided to build a simple new modifier. I was torn betweenresolveandretrieve.So in short: The modifier resolves query builders and returns, if provided, the item for a specific index or just the whole array of data.