Port v7@2aa0dfb2c5 - WIP

This commit is contained in:
Stephan
2018-03-27 10:04:07 +02:00
parent a2a4edb3be
commit 0a4878d2a3
119 changed files with 3016 additions and 1376 deletions

View File

@@ -0,0 +1,26 @@
using AutoMapper;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
internal class ContentChildOfListViewResolver : IValueResolver<IContent, ContentItemDisplay, bool>
{
private readonly IContentService _contentService;
private readonly IContentTypeService _contentTypeService;
public ContentChildOfListViewResolver(IContentService contentService, IContentTypeService contentTypeService)
{
_contentService = contentService;
_contentTypeService = contentTypeService;
}
public bool Resolve(IContent source, ContentItemDisplay destination, bool destMember, ResolutionContext context)
{
// map the IsChildOfListView (this is actually if it is a descendant of a list view!)
var parent = _contentService.GetParent(source);
return parent != null && (parent.ContentType.IsContainer || _contentTypeService.HasContainerInPath(parent.Path));
}
}
}