Skip to content

Commit

Permalink
Also duplicates translated page contents
Browse files Browse the repository at this point in the history
fixes #43
  • Loading branch information
der-On authored Jul 2, 2024
1 parent 728d2f0 commit daa1c36
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,7 @@ public function onDuplicateObject(): array
$this->validateRequestTheme();
$type = $this->getObjectType();

$object = ObjectHelper::loadObject(
$this->theme,
$type,
trim(Request::input('objectPath'))
);
$object = $this->getObjectFromRequest();
$parentPage = null;
$parent = null;

Expand All @@ -306,9 +302,10 @@ public function onDuplicateObject(): array
}
}

$className = get_class($object);
$data = $object->toArray();
$duplicatedObject = new $className($data);
// simply clone the entire object
$duplicatedObject = clone $object;
// must remove the file name or this page will not be unique
unset($duplicatedObject->fileName);

$widget = $this->makeObjectFormWidget($type, $duplicatedObject);
$this->vars['objectPath'] = '';
Expand Down

0 comments on commit daa1c36

Please sign in to comment.