mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
#18781: Adding ContainablePartDriver import/export
Work Item: 18781 --HG-- branch : 1.x extra : transplant_source : %FE%E4Q.%C9%82%F8%81%15%FA%BCD%A8%92%7C%CF%09%9D%85X
This commit is contained in:
parent
99be8137d0
commit
37fb92f274
@ -7,6 +7,7 @@ using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Containers.ViewModels;
|
||||
using Orchard.Localization;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
|
||||
namespace Orchard.Core.Containers.Drivers {
|
||||
public class ContainablePartDriver : ContentPartDriver<ContainablePart> {
|
||||
@ -65,5 +66,15 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Importing(ContainablePart part, ImportContentContext context) {
|
||||
var weight = context.Attribute(part.PartDefinition.Name, "Weight");
|
||||
if (weight != null) {
|
||||
part.Weight = Convert.ToInt32(weight);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(ContainablePart part, ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Weight", part.Weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user