Layout Builder + Paragraphs preview mode white screen
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3590041. --> Reported by: [gcb](https://www.drupal.org/user/1682976) Related to !170 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>After enabling frontend editing on a site with Paragraphs and Layout Builder in use on a node type, attempting to edit a layout for the node type crashes:</p> <pre>The website encountered an unexpected error. Try again later.<br><br>Error: Call to a member function hasLinkTemplate() on null in Drupal\frontend_editing_paragraphs\EventSubscriber\PreviewSubscriber-&gt;onDataAdminUi() (line 87 of modules/contrib/frontend_editing/modules/frontend_editing_paragraphs/src/EventSubscriber/PreviewSubscriber.php).<br>call_user_func(Array, Object, 'Drupal\frontend_editing\Event\DataAdminUI', Object) (Line: 111)<br>Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch(Object) (Line: 215)<br>Drupal\frontend_editing\Plugin\ExtraField\Display\FrontendEditing-&gt;view(Object) (Line: 118)<br>Drupal\extra_field\Plugin\ExtraFieldDisplayManager-&gt;entityView(Array, Object, Object, 'default') (Line: 28)<br>extra_field_entity_view(Array, Object, Object, 'default')<br>call_user_func_array(Object, Array) (Line: 416)<br>Drupal\Core\Extension\ModuleHandler-&gt;Drupal\Core\Extension\{closure}(Object, 'extra_field') (Line: 395)<br>Drupal\Core\Extension\ModuleHandler-&gt;invokeAllWith('entity_view', Object) (Line: 415)<br>Drupal\Core\Extension\ModuleHandler-&gt;invokeAll('entity_view', Array) (Line: 289)<br>Drupal\Core\Entity\EntityViewBuilder-&gt;buildMultiple(Array) (Line: 19)<br>Drupal\paragraphs\ParagraphViewBuilder-&gt;buildMultiple(Array) (Line: 239)<br>Drupal\Core\Entity\EntityViewBuilder-&gt;build(Array)<br>call_user_func_array(Array, Array) (Line: 113)<br>Drupal\Core\Render\Renderer-&gt;doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 886)<br>Drupal\Core\Render\Renderer-&gt;doCallback('#pre_render', Array, Array) (Line: 431)<br>Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 248)<br>Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 484)<br>Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, 'html', NULL, 1) (Line: 49)<br>__TwigTemplate_db00a208419e4180ce8f8e2f360df61c-&gt;doDisplay(Array, Array) (Line: 402)<br>Twig\Template-&gt;yield(Array, Array) (Line: 358)<br>Twig\Template-&gt;display(Array) (Line: 373)<br>Twig\Template-&gt;render(Array) (Line: 51)<br>Twig\TemplateWrapper-&gt;render(Array) (Line: 33)<br>twig_render_template('...../templates/fields/field--node--field-content-paragraphs.html.twig', Array) (Line: 348)<br>...</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>configure a node type to use layout builder. Add a paragraph field with at least one paragraph type to the node type, configure it to display in the layout builder layout. Install and enable frontend editing for the content type and paragraph field.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Check to see if an entity is being previewed using a ghost entity before adding the frontend editing extra_field.</p>
issue