You are here

protected function ParagraphDeleteForm::shouldCreateNewRevision in Paragraphs table 8

Checks if a given entity should be saved as a new revision by default.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check for default new revision.

Return value

bool TRUE if this entity is set to be saved as a new revision by default, FALSE otherwise.

1 call to ParagraphDeleteForm::shouldCreateNewRevision()
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 117

Class

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

Namespace

Drupal\paragraphs_table\Form

Code

protected function shouldCreateNewRevision(EntityInterface $entity) {
  $new_revision_default = FALSE;
  if ($bundle_entity_type = $entity
    ->getEntityType()
    ->getBundleEntityType()) {
    $bundle_entity = $this->entityTypeManager
      ->getStorage($bundle_entity_type)
      ->load($entity
      ->bundle());
    if ($bundle_entity instanceof RevisionableEntityBundleInterface) {
      $new_revision_default = $bundle_entity
        ->shouldCreateNewRevision();
    }
  }
  return $new_revision_default;
}