silverstripe / silverstripe-subsites

Subsites module for Silverstripe CMS
http://addons.silverstripe.org/add-ons/silverstripe/subsites
BSD 3-Clause "New" or "Revised" License
65 stars 106 forks source link

Copying a blocks page to a subsite does not copy blocks #393

Closed brynwhyman closed 5 years ago

brynwhyman commented 6 years ago

Using dnadesign/silverstripe-elemental 4.x-dev 4aee187

If a blocks page includes draft/saved/published blocks, when copying to the page to a subsite through 'Subsite Operations' function, the expected result is the page and the containing blocks are copied to the subsite. Current behaviour copies the page but does not include the saved/published blocks.

Comment from @robbieaverill

We probably need to implement recursive duplication. I think subsites has some of its own logic for duplicating across subsites, I refactored some of it recently. It should be using the recursive duplication logic from core as much as possible though. It's also possible that this is fixed with an unreleased version of subsites, need to check.

Also I think this would be a subsites fix (when we treat elements as arbitrary examples of related models), so we could move this to subsites if you want to @brynwhyman ?

sminnee commented 6 years ago

Underlying issue is that duplicateToSubsite() doesn't respect cascade_duplicates, it instead has its own setting duplicate_to_subsite_relations

Two possible solutions:

https://github.com/silverstripe/silverstripe-subsites/blob/master/src/Extensions/SiteTreeSubsites.php#L242

NightJar commented 6 years ago

Option 2 is the better approach :)

robbieaverill commented 5 years ago

Worth noting that we've deprecated duplciateSubsiteRelations in favour of the cascade duplicates API already.

I actually can't reproduce this issue using SilverStripe 4.4.x-dev, Subsites 2.3.x-dev and Elemental 4.1.x-dev

robbieaverill commented 5 years ago

Yeah, confirmed this is working in the above modules