#18488: Fixing import/export for Orchard.Fields

Work Item: 18488

--HG--
branch : 1.x
This commit is contained in:
TheMonarch
2012-02-27 16:56:19 -08:00
parent 40fb64a5c3
commit a251b49686
2 changed files with 21 additions and 1 deletions

View File

@@ -5,4 +5,4 @@ ce578373f907c0a55fd91229a344f0755f290174 src/Orchard.Web/Modules/Orchard.TaskLea
a7c7f06ac79d4db2f4295a2a1473417647e6889c src/Orchard.Web/Modules/Orchard.Tokens
88a640948e19a1a9dd79b859856375e292d53f2f src/orchard.web/Modules/Orchard.Alias
86cb87517264e94d8fe9a3049d6425a1deb5b613 src/orchard.web/Modules/Orchard.Projections
94fad0aca65eb41ccd7fe5fa3f6b8e952d36c34b src/orchard.web/modules/Orchard.Fields
3d079e6db8e595272b1ccd77966f60d07e0c4112 src/orchard.web/modules/Orchard.Fields

View File

@@ -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);
}