Skip to content

Commit

Permalink
V8: Use member type icon in member pickers (#6696)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenn Jacobsen authored and nul800sebastiaan committed Oct 24, 2019
1 parent 6a8d314 commit b103778
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ private static void Map(IEntitySlim source, EntityBasic target, MapperContext co
target.Trashed = source.Trashed;
target.Udi = Udi.Create(ObjectTypes.GetUdiType(source.NodeObjectType), source.Key);

if (source.NodeObjectType == Constants.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace())
target.Icon = Constants.Icons.Member;

if (source is IContentEntitySlim contentSlim)
{
source.AdditionalData["ContentTypeAlias"] = contentSlim.ContentTypeAlias;
Expand Down Expand Up @@ -226,7 +223,18 @@ private static void Map(ISearchResult source, SearchResultEntity target, MapperC
}

private static string MapContentTypeIcon(IEntitySlim entity)
=> entity is ContentEntitySlim contentEntity ? contentEntity.ContentTypeIcon : null;
{
switch (entity)
{
case ContentEntitySlim contentEntity:
// NOTE: this case covers both content and media entities
return contentEntity.ContentTypeIcon;
case MemberEntitySlim memberEntity:
return memberEntity.ContentTypeIcon.IfNullOrWhiteSpace(Constants.Icons.Member);
}

return null;
}

private static string MapName(IEntitySlim source, MapperContext context)
{
Expand Down

0 comments on commit b103778

Please sign in to comment.