Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

When a block or media item is published get all pages using the block or media item

$
0
0

Hi,

I need to get all the pages that use a block or media item when that block or media item is published. I can hook into the publish event ok and I can get pages using

var repository = ServiceLocator.Current.GetInstance<IContentRepository>();
var references = repository.GetReferencesToContent(e.ContentLink, true).ToList();

However if a block is nested within a block the above will only get the parent block and not the page where the parent block is used. Similarly if a block was nested several times then it would only get the immediate parent.

Has anyone done anything similar in the past to get the ultimate page using the block?

Thanks,

Mark


Viewing all articles
Browse latest Browse all 9076

Trending Articles