You are here

public function ParagraphDeleteForm::saveNewRevision in Paragraphs table 8

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.

1 call to ParagraphDeleteForm::saveNewRevision()
ParagraphDeleteForm::submitForm in src/Form/ParagraphDeleteForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/ParagraphDeleteForm.php, line 142

Class

ParagraphDeleteForm
Provides a form for deleting a paragraph from a node.

Namespace

Drupal\paragraphs_table\Form

Code

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;
}