in 7.6 how do i use this with nested content?
rbaty-barr opened this issue · 2 comments
rbaty-barr commented
i am close, but not really experienced with Models Builder, can you provide me a bit more of a full example with nested content in mind?
bjarnef commented
I have just used the multi url picker inside Nested Content for columns in footer with a heading + links.
https://twitter.com/bfyrstenborg/status/926356380285652994
@{
var footerLinks = site.FooterLinks ?? Enumerable.Empty<IPublishedContent>();
<div class="row">
@foreach (var item in footerLinks)
{
var links = item.GetPropertyValue<IEnumerable<Link>>("links");
<div class="col-sm-4 col-md-4">
<h3>@item.GetPropertyValue("heading")</h3>
@if (links != null && links.Any())
{
<ul class="list-unstyled links">
@foreach (var link in links)
{
<li><a href="@link.Url" title="@link.Name" target="@link.Target">@link.Name</a></li>
}
</ul>
}
</div>
}
</div>
}
or if you only use one document type in nested content.
@{
var footerLinks = site.FooterLinks ?? Enumerable.Empty<IPublishedContent>();
<div class="row">
@foreach (var item in footerLinks.OfType<NestedLinks>())
{
<div class="col-sm-4 col-md-4">
<h3>@item.Heading</h3>
@if (item.Links != null && item.Links.Any())
{
<ul class="list-unstyled links">
@foreach (var link in item.Links)
{
<li><a href="@link.Url" title="@link.Name" target="@link.Target">@link.Name</a></li>
}
</ul>
}
</div>
}
</div>
}
rasmusjp commented
Guess you've figured it out, so closing