Changes filter of deprecated property editors to be on controller level instead of resolver

This commit is contained in:
Niels Hartvig
2018-02-26 09:22:54 +01:00
parent 3da9fddd64
commit fa85ce39c7
3 changed files with 9 additions and 8 deletions

View File

@@ -461,7 +461,7 @@ namespace Umbraco.Core
ApplicationCache.RuntimeCache,
new ManifestParser(new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), ApplicationCache.RuntimeCache));
PropertyEditorResolver.Current = new PropertyEditorResolver(ServiceProvider, ProfilingLogger.Logger, () => PluginManager.ResolvePropertyEditors(), builder, UmbracoConfig.For.UmbracoSettings().Content);
PropertyEditorResolver.Current = new PropertyEditorResolver(ServiceProvider, ProfilingLogger.Logger, () => PluginManager.ResolvePropertyEditors(), builder);
ParameterEditorResolver.Current = new ParameterEditorResolver(ServiceProvider, ProfilingLogger.Logger, () => PluginManager.ResolveParameterEditors(), builder);
//setup the validators resolver with our predefined validators

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
using Umbraco.Core.IO;
using Umbraco.Core.Manifest;
@@ -40,11 +39,10 @@ namespace Umbraco.Core.PropertyEditors
_unioned = new Lazy<List<PropertyEditor>>(() => Values.Union(builder.PropertyEditors).ToList());
}
internal PropertyEditorResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> typeListProducerList, ManifestBuilder builder, IContentSection contentSection)
internal PropertyEditorResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> typeListProducerList, ManifestBuilder builder)
: base(serviceProvider, logger, typeListProducerList, ObjectLifetimeScope.Application)
{
_unioned = new Lazy<List<PropertyEditor>>(() => SanitizeNames(Values.Union(builder.PropertyEditors)
.Where(x=>x.IsDeprecated == false || contentSection != null && contentSection.ShowDeprecatedPropertyEditors).ToList()));
_unioned = new Lazy<List<PropertyEditor>>(() => SanitizeNames(Values.Union(builder.PropertyEditors).ToList()));
}
private static List<PropertyEditor> SanitizeNames(List<PropertyEditor> editors)

View File

@@ -20,6 +20,7 @@ using umbraco;
using Constants = Umbraco.Core.Constants;
using System.Net.Http;
using System.Text;
using Umbraco.Core.Configuration;
namespace Umbraco.Web.Editors
{
@@ -340,9 +341,11 @@ namespace Umbraco.Web.Editors
Constants.Applications.Settings, Constants.Applications.Developer)]
public IDictionary<string, IEnumerable<DataTypeBasic>> GetGroupedPropertyEditors()
{
var datatypes = new List<DataTypeBasic>();
var datatypes = new List<DataTypeBasic>();
var showDeprecatedPropertyEditors = UmbracoConfig.For.UmbracoSettings().Content
.ShowDeprecatedPropertyEditors;
var propertyEditors = PropertyEditorResolver.Current.PropertyEditors;
var propertyEditors = PropertyEditorResolver.Current.PropertyEditors.Where(x=>x.IsDeprecated == false || showDeprecatedPropertyEditors);
foreach (var propertyEditor in propertyEditors)
{
var hasPrevalues = propertyEditor.PreValueEditor.Fields.Any();
@@ -377,4 +380,4 @@ namespace Umbraco.Web.Editors
}
#endregion
}
}
}