public function ParagraphLineageRevisioner::saveNewRevision in Paragraphs Edit 8.2
Saves all of given entity's lineage as new revisions.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity whose lineage to save as new revisions.
Return value
int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
File
- src/
ParagraphLineageRevisioner.php, line 47
Class
- ParagraphLineageRevisioner
- ParagraphLineageRevisioner class.
Namespace
Drupal\paragraphs_editCode
public function saveNewRevision(ContentEntityInterface $entity) {
$result = $this
->doSaveNewRevision($entity);
while ($entity instanceof ParagraphInterface) {
$parent = $entity
->getParentEntity();
if (!$parent) {
break;
}
$this
->doSaveNewRevision($parent);
$entity = $parent;
}
return $result;
}