You are here

public function ConfigEntityBase::createDuplicate in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php \Drupal\Core\Config\Entity\ConfigEntityBase::createDuplicate()
  2. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php \Drupal\Core\Config\Entity\ConfigEntityBase::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 EntityBase::createDuplicate

3 calls to ConfigEntityBase::createDuplicate()
Block::createDuplicateBlock in core/modules/block/src/Entity/Block.php
Creates a duplicate of the block entity.
EntityDisplayBase::createCopy in core/lib/Drupal/Core/Entity/EntityDisplayBase.php
Creates a duplicate of the entity display object on a different view mode.
View::createDuplicate in core/modules/views/src/Entity/View.php
Creates a duplicate of the entity.
1 method overrides ConfigEntityBase::createDuplicate()
View::createDuplicate in core/modules/views/src/Entity/View.php
Creates a duplicate of the entity.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php, line 220

Class

ConfigEntityBase

Namespace

Drupal\Core\Config\Entity

Code

public function createDuplicate() {
  $duplicate = parent::createDuplicate();

  // Prevent the new duplicate from being misinterpreted as a rename.
  $duplicate
    ->setOriginalId(NULL);
  return $duplicate;
}