From 674b28659c160343a79b0b99b1414d414da5c31c Mon Sep 17 00:00:00 2001
From: justin2pin <justin2pin@278450.no-reply.drupal.org>
Date: Thu, 16 Jul 2020 22:48:21 -0600
Subject: [PATCH] Issue #3159353 by justin2pin, Drupak: Paragraphs inside the
 second section not observing Layout

---
 src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php b/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php
index d1faa83c..5038a03e 100644
--- a/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php
+++ b/src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php
@@ -863,7 +863,7 @@ class LayoutParagraphsWidget extends WidgetBase implements ContainerFactoryPlugi
     $layout_element['preview']['regions'] = ['#weight' => 100] + $layout_element['#layout_instance']->build($layout_element['preview']['regions']);
     $layout_element['preview']['regions']['#parents'] = $layout_element['#parents'];
     foreach ($elements as $index => $element) {
-      if ($element['#parent_uuid'] == $uuid) {
+      if (!empty($element['#region']) && $element['#parent_uuid'] == $uuid) {
         /* @var \Drupal\Core\Entity\EntityInterface $child_entity */
         $child_entity = $element['#entity'];
         $child_uuid = $child_entity->uuid();
-- 
GitLab