referencedEntities() function return blank in node preview page

Created on 3 May 2017, almost 8 years ago
Updated 23 July 2023, over 1 year ago

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.

💬 Support request
Status

Closed: duplicate

Version

1.2

Component

Code

Created by

🇮🇳India NitinSP

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024