diff --git a/.hgsubstate b/.hgsubstate index a2c0e96e6..56ba1bfea 100644 --- a/.hgsubstate +++ b/.hgsubstate @@ -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 diff --git a/src/Orchard/ContentManagement/Handlers/ImportContentContext.cs b/src/Orchard/ContentManagement/Handlers/ImportContentContext.cs index e592447dc..73f4fa8e5 100644 --- a/src/Orchard/ContentManagement/Handlers/ImportContentContext.cs +++ b/src/Orchard/ContentManagement/Handlers/ImportContentContext.cs @@ -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 value) { + ImportAttribute(elementName, attributeName, value, () => { }); + } + + public void ImportAttribute(string elementName, string attributeName, Action 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); }