Open leonixyz opened 7 years ago
Thanks for reporting this. It seems like a necessary and easy to achieve feature; We should be able to simply hook into onAfterDuplicate and reset the urlsegment on all locales. Is resetting to empty (failover to default locale urlsegment) ok for the duplicated page?
still an issue in silverstripe 5.
Without testing it in detail, my guess is that it's caused by the raw sql insert being run in FluentExtension->onAfterDuplicate()
.
As a workaround I added the following to my Page class which fixes the issue:
public function duplicate(bool $doWrite = true, array|null $relations = null): static
{
$new = parent::duplicate($doWrite, $relations);
$new->forceChange();
$new->write();
return $new;
}
Hello,
Fluent version 3.8.0 seems to have a problem with CMS' built-in "duplicate page" feature. Tested with silverstripe/cms and silverstripe/framework version 3.5.2.
If one duplicates a page, the URL segment is updated only for the page in the main language (a "-2" is appended to the segment). For other languages, however, the segment is kept untouched, leading to a conflict with the original page.
This is a big problem if one is using the CMS in split mode, and tries to edit the new page for a non-main language: the CMS automatically redirects the user to the original page.
I think there should be some code in Fluent handling page duplication, and updating the URL segment for all languages.
Hope I explained it well.
Thanks