Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public override async Task UpdatedAsync(UpdateContentContext context, AutorouteP
await GenerateContainedPathsFromPatternAsync(context.ContentItem, part);
}

public override async Task CloningAsync(CloneContentContext context, AutoroutePart part)
public override async Task ClonedAsync(CloneContentContext context, AutoroutePart part)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to change the OC.Flow startup order instead

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think is better to keep this in Cloning and change the startup order.

{
if (!context.CloneContentItem.TryGet<AutoroutePart>(out var clonedPart))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Nodes;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Handlers;
using OrchardCore.ContentManagement.Routing;
using OrchardCore.Flows.Models;
Expand All @@ -7,6 +8,25 @@ namespace OrchardCore.Flows.Handlers;

public class BagPartHandler : ContentPartHandler<BagPart>
{
private readonly IContentItemIdGenerator _idGenerator;

public BagPartHandler(IContentItemIdGenerator idGenerator) => _idGenerator = idGenerator;

public override Task CloningAsync(CloneContentContext context, BagPart part)
{
if (context.CloneContentItem.TryGet<BagPart>(out var clonedBagPart))
{
foreach (var contentItem in clonedBagPart.ContentItems)
{
contentItem.ContentItemId = _idGenerator.GenerateUniqueId(contentItem);
}

clonedBagPart.Apply();
}

return Task.CompletedTask;
}

public override Task GetContentItemAspectAsync(ContentItemAspectContext context, BagPart part)
{
return context.ForAsync<ContainedContentItemsAspect>(aspect =>
Expand Down
Loading