verbb / vizy

A flexible visual editor for Craft CMS
Other
44 stars 8 forks source link

Full Support for Dynamic Paths (bug or FR?) 🤷🏻‍♂️ #68

Closed kerns closed 3 years ago

kerns commented 3 years ago

Description I use a dynamic path for assets attached to entries, and it's a little bit unusual. It looks like this:

Automobiles/{postDate|date('Y')}/{{postDate|date('m')}}/{{model.one().slug}}-{{id}}

I know this is weird but the result is that assets are browsable on disk in a coherent, human-readable way. I would like to do the same thing with assets attached through Vizy using something like this on the asset field:

Automobiles/{postDate|date('Y')}/{{postDate|date('m')}}/{{model.one().slug}}-{{id}}/Story

The result is always something like:

https://dqnk0a84a3tow.cloudfront.net/site/Automobiles/2021/08//Story/IMG_1759_2021-08-12-154418_xtsf.jpeg

Where .../2021/08/ferrari-365-gt4-3143/Story/IMG_1759_2021-08-12-154418_xtsf.jpeg is the desired result.

Is there any reason why this particular dynamic field (working and available to the entry assets field) wouldn't jive with Vizy? Should I give up on this or is there another way to tackle it?

kerns commented 3 years ago

owner ...I was missing {owner.model.one().slug}. Also one too many braces. :)

engram-design commented 3 years ago

That's correct, similar to Matrix fields, you'll want to use owner to reference the element that "owns" the Vizy field.