However that will contain the reference to whichever IPublishedContent object that Ditto is currently processing.
If you want the actual "Current Page" (as per the node that matches the URL), then you'd need to go with UmbracoContext, something like this...
var currentPage = UmbracoContext.Current.ContentCache.GetById(UmbracoContext.Current.PageId.Value);
I use this for when I'm mapping against "fake" IPublishedContent object, like from Nested Content, and I need to get something from the actual current page's content node.
Getting CurrentPage within DittoProcessorAttribute
Hi All,
Was wondering if there's any way I can get the CurrentPage (of IPublishedContent) within a DittoProcessorAttribute?
Do i have to create a processor to pass them in like the one below https://jamiepollock.github.io/blog/2016/06/15/getting-started-with-ditto-processors
Or is there an easier / quicker way.
Appreciate all the help
Thanks
In your processor,
Context.Content
is what you need, as I remember it.As Casper says
Context.Content
will do it.However that will contain the reference to whichever IPublishedContent object that Ditto is currently processing.
If you want the actual "Current Page" (as per the node that matches the URL), then you'd need to go with UmbracoContext, something like this...
I use this for when I'm mapping against "fake" IPublishedContent object, like from Nested Content, and I need to get something from the actual current page's content node.
I hope this helps?
Cheers,
- Lee
is working on a reply...