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

Dynamic Field output in twig breaks Live Preview #24

Open
Tim-Wils opened this issue Jan 25, 2019 · 0 comments
Open

Dynamic Field output in twig breaks Live Preview #24

Tim-Wils opened this issue Jan 25, 2019 · 0 comments

Comments

@Tim-Wils
Copy link

Outputting the field in twig breaks the Live Preview functionality and gives an error.
The problem is that the field needs to be json_encoded in the Live Preview.

To workaround this problem, this is a fix on the twig-side:

{% if craft.app.request.isLivePreview %} {{ myDynamicField|json_encode}} {% else %} {{ myDynamicField }} {% endif %}

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

1 participant