-
-
Notifications
You must be signed in to change notification settings - Fork 809
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
Repeater fields are omitted when viewing the "preview" link of a record #6605
Comments
This seems to be a tricky one to solve. Let's say we have this:
And in the foobar.twig we use:
When "previewing" a record with this, the repeater fields are passed in to the template as plain arrays: When viewing the actual saved page, the repeaters work as expected: I don't know if it's feasible to fix this. |
This will probably affect the upcoming Named Repeaters as well. |
I can't see how this causes an issue, yes the objects/arrays are different but if in the template you use:
then as far as I can see the same code will work wether the repeater is a raw array or one of the lazy objects which is only a pointer to the same data structure underneath. |
In that case they will "just" not work when you're previewing a record which template uses the So:
We can live with that. |
@rossriley It's working in that case because it isn't using the |
Yes, looks like that's the case. I'm guessing the best way to do this is to find a way to hydrate the content object correctly in the |
Closed by #6633 |
This is still broken. (Bolt 3.3.1) |
Just my two cents, this is my quick and dirty solution when rendering templates: {% set is_preview = attribute(item, 'values') is not defined %}
{% set data = is_preview ? item.field_name : item.get('field_name') %}
{{ data }} |
Yes, this is true, unfortunately. It's not something that's feasible to change in the short run, though.. I think |
After giving it some more thought, let's just update the docs and make the 'dot notation' the recommended way.. That'll work in both "regular" as well as in "preview", and doesn't require cumbersome See here: bolt/docs#838 So, closing this one again. Hopefully for good, this time. :-) |
This one is pretty straight forward, when you have a repeater in your content type and try to use the preview link for a record on the backend, you're taken to the preview page but all fields that are part of the repeater are omitted.
Details
The text was updated successfully, but these errors were encountered: