I am using paragraph module and using that creating paragraph as well as nested paragraph.
So for fetching nested paragraph field data from $paragraph object in Hook_preprocess_paragraph() function I have used referencedEntities().

Below are the code written for paragraph preprocess hook.

$paragraph = $variables['elements']['#paragraph'];
$variables['download_file_list'] = $paragraph->get('field_files')->referencedEntities();

If I access page using node/ [nid] this code is return reference entity values, but if I edit same page and click "Preview" button to preview node referencedEntities() return blank.

So please let me know how we get reference entities in node preview page.

Comments

NitinSP created an issue. See original summary.

nitinsp’s picture

Issue summary: View changes
miro_dietiker’s picture

Category: Bug report » Support request

That looks more like a custom support request than a Paragraphs/ERR bug?

dieterholvoet’s picture

Status: Active » Closed (duplicate)

This issue is fixed by the patch in #3098924: referencedEntities() causes data loss.