In V7, i would have a view, that took nested content and looped through them looking for a Document Type Alias and matching it to a Partial view name.
That view would then be rendered out.
In V8 i cannot get it to do the same thing as i cannot pass the data (contentModule) from the Nested Content Document type in the loop, to the partial.
Umbraco 8 Modular Nested Content
Hello,
In V7, i would have a view, that took nested content and looped through them looking for a Document Type Alias and matching it to a Partial view name. That view would then be rendered out.
In V8 i cannot get it to do the same thing as i cannot pass the data (contentModule) from the Nested Content Document type in the loop, to the partial.
Is there a way to do this or better in V8?
code:
TIA, Sam
Doing this out of my head, but I believe you could do something like this.
Or perhaps with a switch /case?
I use this pattern, works in v8 with some minor changes (IPublishedContent is now IPublishedElement): https://gist.github.com/ChesterCampbellAM/2e9e14de81a4ee242eee46ce6c4936e4
Regards, Magnus
Hi Guys,
Thank you both for your input it's helped greatly!
I tried several ways and managed to settle on:
Template:
Partial:
This article also helped: https://our.umbraco.com/forum/templates-partial-views-and-macros/97248-nested-content-in-separate-partials
@ Marcus - I will try your method too as im keen to learn other ways :)
Many thanks again guys.
is working on a reply...