You are here

public function BlockContent::createDuplicate in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::createDuplicate()

Creates a duplicate of the entity.

Return value

static A clone of $this with all identifiers unset, so saving it inserts a new entity into the storage system.

Overrides ContentEntityBase::createDuplicate

File

core/modules/block_content/src/Entity/BlockContent.php, line 97

Class

BlockContent
Defines the custom block entity class.

Namespace

Drupal\block_content\Entity

Code

public function createDuplicate() {
  $duplicate = parent::createDuplicate();
  $duplicate->revision_id->value = NULL;
  $duplicate->id->value = NULL;
  return $duplicate;
}