BlockContent::createDuplicate

public 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 81

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;
}
doc_Drupal
2016-10-29 08:46:42
Comments
Leave a Comment

Please login to continue.