mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#18488: Fixing import/export for Orchard.Fields
Work Item: 18488 --HG-- branch : 1.x
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Orchard.ContentManagement.Handlers {
|
||||
@@ -21,6 +22,25 @@ namespace Orchard.ContentManagement.Handlers {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ImportAttribute(string elementName, string attributeName, Action<string> value) {
|
||||
ImportAttribute(elementName, attributeName, value, () => { });
|
||||
}
|
||||
|
||||
public void ImportAttribute(string elementName, string attributeName, Action<string> value, Action empty) {
|
||||
var importedText = Attribute(elementName, attributeName);
|
||||
if (importedText != null) {
|
||||
try {
|
||||
value(importedText);
|
||||
}
|
||||
catch {
|
||||
empty();
|
||||
}
|
||||
}
|
||||
else {
|
||||
empty();
|
||||
}
|
||||
}
|
||||
|
||||
public ContentItem GetItemFromSession(string id) {
|
||||
return Session.Get(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user