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

This commit is contained in:
Shannon
2013-11-21 18:10:47 +11:00
parent 8860e77468
commit 22be517daf
2 changed files with 7 additions and 3 deletions

View File

@@ -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
/// </summary>
internal static class LegacyParameterEditorAliasConverter
public static class LegacyParameterEditorAliasConverter
{
/// <summary>
/// The map consists of a key which is always the legacy alias + new alias (trimmed))

View File

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