public ContentLayoutMapPartHandler(
            ILayoutContentMapService layoutContentMapService,
            IContentManager contentManager)
        {
            _contentManager = contentManager;
            _layoutContentMapService = layoutContentMapService;

            OnLoading<ContentLayoutMapPart>((context, part) => LazyLoadHandlers(part));
        }
Ejemplo n.º 2
0
        public LayoutPartHandler(ILayoutManager layoutManager, ILayoutContentMapService layoutContentMapService)
        {
            _layoutManager = layoutManager;
            _layoutContentMapService = layoutContentMapService;

            OnUpdated<LayoutPart>((context, part) => {

                var elements = _layoutManager.LoadElements(part).Flatten();
                var contentItemIds = elements
                    .Where(e => e is ContentItem)
                    .Cast<ContentItem>()
                    .SelectMany(c => c.ContentItemIds)
                    .ToList();

                _layoutContentMapService.LayoutPartUpdated(part.Id, contentItemIds);
            });

            OnRemoved<LayoutPart>((context, part) =>
            {
                _layoutContentMapService.LayoutPartRemoved(part.Id);
            });
        }