Score:0

How to load the previous revision of a paragraph?

cn flag

I can load paragraphes of a nodes field using

$paragraphs = $node->get('my_field')->referencedEntities()

In hook_node_update I could load the previous paragraphes using

$paragraphs = $node->original->get('my_field')->referencedEntities()

But instead I would like to load the previews paragraph from their id, somethings like:

$paragraphs = $node->get('my_field')->referencedEntities()

foreach ($paragraphs as $key => $paragraph) {
  // getRevisionIDs is pseudo code and does not exist
  $revisionIds = getRevisionIDs($paragraph['entityKeys]['id'])
  $previewParagraph = \Drupal::entityTypeManager()->getStorage('paragraph')->loadRevision($revisionIds[1])
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.