From 22be517daf014ee3f972824d0be94ce359c7a5d2 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 21 Nov 2013 18:10:47 +1100 Subject: [PATCH] publicizes the legacy parameter editor alias map, ensures that a YSOD is not shown when a legacy parameter editor is trying to be rendered, we just render a text box in its place --- .../LegacyParameterEditorAliasConverter.cs | 2 +- src/Umbraco.Web/Models/Mapping/MacroModelMapper.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/PropertyEditors/LegacyParameterEditorAliasConverter.cs b/src/Umbraco.Core/PropertyEditors/LegacyParameterEditorAliasConverter.cs index 41a0b439d8..cc89e7671b 100644 --- a/src/Umbraco.Core/PropertyEditors/LegacyParameterEditorAliasConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/LegacyParameterEditorAliasConverter.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.PropertyEditors /// Used to map the legacy parameter editor aliases to the new ones, this is really just used during /// installation but has been put in a separate class in case we need it for other purposes /// - internal static class LegacyParameterEditorAliasConverter + public static class LegacyParameterEditorAliasConverter { /// /// The map consists of a key which is always the legacy alias + new alias (trimmed)) diff --git a/src/Umbraco.Web/Models/Mapping/MacroModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MacroModelMapper.cs index e3456189ca..4122cdd422 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroModelMapper.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using AutoMapper; using Umbraco.Core; +using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Mapping; using Umbraco.Core.PropertyEditors; @@ -34,12 +35,15 @@ namespace Umbraco.Web.Models.Mapping var paramEditor = ParameterEditorResolver.Current.GetByAlias(property.EditorAlias); if (paramEditor == null) { - throw new InvalidOperationException("Could not resolve macro parameter editor: " + property.EditorAlias); + //we'll just map this to a text box + paramEditor = ParameterEditorResolver.Current.GetByAlias(Constants.PropertyEditors.TextboxAlias); + LogHelper.Warn("Could not resolve a parameter editor with alias " + property.EditorAlias + ", a textbox will be rendered in it's place"); } - parameter.View = paramEditor.ValueEditor.View; + parameter.View = paramEditor.ValueEditor.View; //set the config parameter.Configuration = paramEditor.Configuration; + }); }