diff --git a/src/Entity/Paragraph.php b/src/Entity/Paragraph.php index ed65403..bcbaaf0 100644 --- a/src/Entity/Paragraph.php +++ b/src/Entity/Paragraph.php @@ -563,6 +563,15 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface, EntityN $summary_count += $paragraph_entity->getSummaryCount(); } } + // If we start with the closed summary the $value['entity'] is not + // calculated so we load the entity ourselves. + elseif (isset($value['target_id']) && isset($value['target_revision_id'])) { + $paragraph_entity = \Drupal::entityTypeManager() + ->getStorage('paragraph') + ->loadRevision($value['target_revision_id']); + $summary[] = $paragraph_entity->getSummary(); + $summary_count += $paragraph_entity->getSummaryCount(); + } } return \Drupal::translation() diff --git a/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php b/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php index d4b4c61..f40f4fa 100644 --- a/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php +++ b/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php @@ -190,7 +190,7 @@ class ParagraphsExperimentalBehaviorsTest extends ParagraphsExperimentalTestBase // Assert that the summary includes the text of the behavior plugins. $this->clickLink('Edit'); $this->assertRaw('class="paragraphs-collapsed-description">first_paragraph, Text color: blue, Bold: Yes'); - $this->assertRaw('class="paragraphs-collapsed-description">0 Children | , Bold: Yes'); + $this->assertRaw('class="paragraphs-collapsed-description">1 Child | nested_paragraph, Text color: blue, Bold: No, Bold: Yes'); } /**