verbb / vizy

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

Preparse Field does not appear to work inside Vizy blocks #195

Closed tomkiss closed 1 year ago

tomkiss commented 1 year ago

What are you trying to do?

I'd like to use a Preparse Field inside a Vizy block. Preparse works excellently across most situations, including inside Matrix blocks.

However, within Vizy, it does not seem to be able to work out where it is in order to successfully render its content. It loads fine but the actual contents of the field are always null.

What's your proposed solution?

I'm not entirely sure what's needed here! After some investigation, I think that this falls more on the Vizy side. I believe that there are some methods that Preparse uses that, if made available by Vizy, may ensure it works. However, I'd need some clarification from the plugins author.

Additional context

I posted a bug report to this on the Preparse Field Github, but I'm now less sure that this issue falls on the Preparse side. I can't be sure who is best to ask.

engram-design commented 1 year ago

Are you able to let me know what Vizy/Craft version you're on? (hint, this is more a bug report than a feature request).

engram-design commented 1 year ago

But, going off the assumption this is the latest, you're correct there's an issue with Preparse. This is because Vizy blocks are a little different, that they're not real elements. Otherwise, Preparse would hook into each block being saved (like Matrix does), but that doesn't happen with Vizy.

I've added support for this though. Please note you'll need to treat it like a Matrix field with using owner - e.g. {{ element.owner.title }}. You'll also be required to set the "Parse before save" option for the field.

To get this early, run composer require verbb/vizy:"dev-craft-4 as 2.0.10"

engram-design commented 1 year ago

Fixed in 2.0.11

tomkiss commented 1 year ago

Apologies for the delay in replying. Thanks so much for looking into this! 🙌