use Guid for Key
This commit is contained in:
@@ -161,17 +161,17 @@ namespace Umbraco.Web.PropertyEditors
|
||||
internal class BlockEditorValues
|
||||
{
|
||||
private readonly IBlockEditorDataHelper _dataHelper;
|
||||
private readonly Lazy<Dictionary<string, IContentType>> _contentTypes;
|
||||
private readonly Lazy<Dictionary<Guid, IContentType>> _contentTypes;
|
||||
|
||||
public BlockEditorValues(IBlockEditorDataHelper dataHelper, IContentTypeService contentTypeService)
|
||||
{
|
||||
_dataHelper = dataHelper;
|
||||
_contentTypes = new Lazy<Dictionary<string, IContentType>>(() => contentTypeService.GetAll().ToDictionary(c => c.Key));
|
||||
_contentTypes = new Lazy<Dictionary<Guid, IContentType>>(() => contentTypeService.GetAll().ToDictionary(c => c.Key));
|
||||
}
|
||||
|
||||
private IContentType GetElementType(JObject item)
|
||||
{
|
||||
var contentTypeKey = item[ContentTypeKeyPropertyKey]?.ToObject<string>() ?? string.Empty;
|
||||
Guid contentTypeKey = item[ContentTypeKeyPropertyKey]?.ToObject<Guid>() ?? Guid.Empty;
|
||||
_contentTypes.Value.TryGetValue(contentTypeKey, out var contentType);
|
||||
return contentType;
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
|
||||
if (!elements.TryGetValue(guidUdi.Guid, out var data))
|
||||
continue;
|
||||
|
||||
// TODO: make this work with key, not Alias.
|
||||
if (!contentTypeMap.TryGetValue(data.ContentType.Alias, out var blockConfig))
|
||||
// Make this work with Key, not alias, since contentTypeMap is now a dctionary with contentTypeKey as the dictionary key.
|
||||
if (!contentTypeMap.TryGetValue(data.ContentType.Key, out var blockConfig))
|
||||
continue;
|
||||
|
||||
// this can happen if they have a settings type, save content, remove the settings type, and display the front-end page before saving the content again
|
||||
|
||||
Reference in New Issue
Block a user