-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#7412: Verified and added several Cloning overrides in many drivers #7592
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,7 @@ | ||||||
using System.Linq; | ||||||
using Orchard.ContentManagement; | ||||||
using Orchard.ContentManagement.Drivers; | ||||||
using Orchard.ContentManagement.Handlers; | ||||||
using Orchard.Core.Navigation.Models; | ||||||
using Orchard.Core.Navigation.Services; | ||||||
using Orchard.Core.Navigation.ViewModels; | ||||||
|
@@ -114,5 +115,11 @@ protected override void Exporting(MenuPart part, ContentManagement.Handlers.Expo | |||||
context.Element(part.PartDefinition.Name).SetAttributeValue("MenuText", part.MenuText); | ||||||
context.Element(part.PartDefinition.Name).SetAttributeValue("MenuPosition", part.MenuPosition); | ||||||
} | ||||||
|
||||||
protected override void Cloning(MenuPart originalPart, MenuPart clonePart, CloneContentContext context) { | ||||||
clonePart.MenuText = originalPart.MenuText; | ||||||
clonePart.MenuPosition = originalPart.MenuPosition; | ||||||
clonePart.Menu = context.CloneContentItem; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,5 +106,12 @@ protected override void Importing(ImageProfilePart part, ImportContentContext co | |
part.Record.Filters.Add(result); | ||
} | ||
} | ||
|
||
protected override void Cloning(ImageProfilePart originalPart, ImageProfilePart clonePart, CloneContentContext context) { | ||
clonePart.Name = originalPart.Name; | ||
clonePart.ModifiedUtc = originalPart.ModifiedUtc; | ||
clonePart.Record.Filters = originalPart.Filters; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Throws YSOD:
Filters are records (and thus references), so they should be cloned too. |
||
clonePart.Record.FileNames = originalPart.FileNames; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to clone these? Shouldn't this start empty, since the new profile doesn't have any images generated? |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,5 +83,14 @@ protected override void Exporting(NavigationQueryPart part, ExportContentContext | |
} | ||
} | ||
} | ||
|
||
protected override void Cloning(NavigationQueryPart originalPart, NavigationQueryPart clonePart, CloneContentContext context) { | ||
clonePart.Items = originalPart.Items; | ||
clonePart.Skip = originalPart.Skip; | ||
} | ||
|
||
protected override void Cloned(NavigationQueryPart originalPart, NavigationQueryPart clonePart, CloneContentContext context) { | ||
clonePart.QueryPartRecord = originalPart.QueryPartRecord; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why is this in Cloned and not Cloning? |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,5 +280,11 @@ private PropertyRecord GetProperty(XElement property) { | |
ZeroIsEmpty = Convert.ToBoolean(property.Attribute("ZeroIsEmpty").Value), | ||
}; | ||
} | ||
|
||
protected override void Cloning(QueryPart originalPart, QueryPart clonePart, CloneContentContext context) { | ||
clonePart.Record.SortCriteria = originalPart.SortCriteria; | ||
clonePart.Record.FilterGroups = originalPart.FilterGroups; | ||
clonePart.Record.Layouts = originalPart.Layouts; | ||
Comment on lines
+285
to
+287
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also throws YSOD. |
||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After you merge from dev, please adjust
Core/Contents/Views/Parts.Contents.Clone.SummaryAdmin.cshtml
andParts.Contents.Publish.SummaryAdmin.cshtml
(line 29) not to include theReturnUrl
parameter.