Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access the entry variable in a _vizy template? #285

Open
jeslage opened this issue Mar 4, 2024 · 2 comments
Open

How to access the entry variable in a _vizy template? #285

jeslage opened this issue Mar 4, 2024 · 2 comments

Comments

@jeslage
Copy link

jeslage commented Mar 4, 2024

Question

Sometimes we need to access the global entry variable in a _vizy/*.twig template. We havent found a solution for this in the documentation or existing issues.
How do we access the variable? Is there a proper way to do this? Currently we fetch the entry again based on the given request uri, but this seems to be a bit inefficient.

Thank you!

Additional context

No response

@jeslage jeslage changed the title How do i access the entry variable in a _vizy template? How to access the entry variable in a _vizy template? Mar 4, 2024
@engram-design
Copy link
Member

I suppose the tricky thing here is that Vizy fields aren't always on an entry, they can be attached to any element. You should be able to access the greater Twig scope with _context, but I'll see what can be done about injecting the owner element into these templates.

@jeslage
Copy link
Author

jeslage commented Mar 4, 2024

Thanks for your fast reply! The _context variable was also my first thought, but I didn't find a parent element on that. That's right, the field is not always a child of an entry, but accessing the parent element would be a nice feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants