Handle unpublished, non-variant content

This commit is contained in:
kjac
2023-02-02 09:29:36 +01:00
parent d04c50b988
commit 54e76b74c4
2 changed files with 1 additions and 2 deletions

View File

@@ -48,7 +48,7 @@ public abstract class ContentMapDefinition<TContent, TPropertyViewModel, TVarian
{
IPropertyValue[] propertyValues = source.Properties.SelectMany(propertyCollection => propertyCollection.Values).ToArray();
var cultures = source.AvailableCultures.DefaultIfEmpty(null).ToArray();
var segments = propertyValues.Select(property => property.Segment).Distinct().ToArray();
var segments = propertyValues.Select(property => property.Segment).Distinct().DefaultIfEmpty(null).ToArray();
return cultures
.SelectMany(culture => segments.Select(segment =>

View File

@@ -17,7 +17,6 @@ public class DocumentMapDefinition : ContentMapDefinition<IContent, DocumentProp
public void DefineMaps(IUmbracoMapper mapper)
=> mapper.Define<IContent, DocumentViewModel>((_, _) => new DocumentViewModel(), Map);
// TODO: handle unpublished, non-variant content
// Umbraco.Code.MapAll
private void Map(IContent source, DocumentViewModel target, MapperContext context)
{