public function Context::duplicate in Context 8.4
Duplicates the context.
File
- src/
Entity/ Context.php, line 383
Class
- Context
- Defines the Context entity.
Namespace
Drupal\context\EntityCode
public function duplicate($label, $name, $description) {
$context = $this
->entityTypeManager()
->getStorage('context')
->load($this
->id());
$clone = $context
->createDuplicate();
$clone
->setName($name);
$clone
->setLabel($label);
$clone
->setDescription($description);
$clone
->save();
}