We've faced a courious behavoir with Paragraph link fields in ERL:
- Create a paragraph with an (optional) link field (maybe add another dummy text field or something to have any content for the later steps)
- Add a kint() to your link paragraphs twig file:
{{ kint(paragraph.field_paragraphs_link.0) }} - Add the paragraph to your ERL layout, leave the link field empty, fill your dummy text field and save the paragraph
- Save your node and return to the node edit
- Your kint should now show NULL
- Edit the paragraph, wait for the modal, close the modal
- Now the kint shows the link 'default object' (MOCK object), regular empty checks in the twig file will fail:
{% if paragraph.field_paragraphs_link.0 %}
This is now TRUE, you have to add:
{% if paragraph.field_paragraphs_link.0 and not paragraph.field_paragraphs_link.0.isEmpty() %}
to have a valid empty check again.
Why does this happen? and it there a way ERL could prevent this, so we can use regular twig empty checks again?
Attached: Screenshot of the kint before and after the AJAX edit.
| Comment | File | Size | Author |
|---|---|---|---|
| erl_link_field_before_and_after_ajax_edit.PNG | 41.82 KB | thomas.frobieter |
Comments