You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, it looks like possibly this happened during some refactoring. LeftAndMainSubsites::copytosubsites looks for the CopyToSubsiteWithChildren key being sent in the data and passes it to duplicateToSubsite method(in SiteTreeSubsites). If you look at that method you'll notice that it doesn't have that second parameter, but calls duplicateSubsiteRelations which does its own internal check based on configuration values (rather than posted field data).
The method signature in subsites 1.4.0 (SilverStripe 3) does accept this value:
This happened due to a combination of these commits: 19758613587bc6 in various merge ups between branches.
Since CopyToSubsiteWithChildren is a checkbox that gets added by SiteTreeSubsites, the fact that it's no longer honouring the value of this checkbox is a valid bug.
The configuration property inspected by SiteTreeSubsites is documented anywhere at all, but performs some custom logic for duplicating relations (note that we should be using cascade_duplicates for this now, so we could deprecate this method).
I think the fix here is to add the missing bool $includeChildren property to the duplicateToSubsite and call ->duplicateWithChildren() rather than $duplicate. Doing this would require it to always write, since SiteTree::duplicateWithChildren doesn't let you pass false into duplicate.
The whole duplicateToSubsitePrep method should really be rewritten to be inside a SubsiteState::singleton()->withState() callback that sets the desired subsite ID then calls $this->owner->duplicate() or $this->owner->duplicateWithChildren() depending on the input $includeChildren.
Would you want to have a go at making a pull request for this?
It seems that the "Include children pages" option when copying a page to a subsite does not do anything.
Within the
copytosubsite
function inLeftAndMainSubsites.php
there is this code:$newPage = $page->duplicateToSubsite($subsite->ID, $includeChildren);
However, the
duplicateToSubsite
function withinSiteTreeSubsites.php
only accepts one argument:public function duplicateToSubsite($subsiteID = null)
It looks like the ability to copy children pages has vanished? I've tested this feature and it definitely only copies the parent page across.
The text was updated successfully, but these errors were encountered: