I have a document type where have multiple properties (itemIcon, itemTitle, itemOverview, etc...) within it. I would like these "widgets" to be able to be used within the grid across different pages in the site - think sidebar promos, pre-footer promos, and so forth.
I've created a data type of "Feature Box" which uses the multinode treepicker, and then in the Grid Editor/LeBlender Editor I've added a property of "Feature Selector" that uses my feature box as the data type.
All is good where I can select the node that I want to load content from, but where I'm stuck now is how do I actually render those properties (the itemIcon, itemTitle, etc) within the view for the Feature Selector? I've tried going with @item.GetValue("itemTitle") and var itemTitle = Model.Items.First().GetValue<dynamic>("itemTitle"); <p>@itemTitle</p> with no success.
Could anyone please help point me in the right direction?
I was able to figure this out after a lot of research combined with trial and error. Here is how I was able to get the properties from the content/document type:
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
@{
var item = Model.Items.ElementAt(0);
var boxPicker = item.GetValue<string>("featureBoxPicker");
if (!string.IsNullOrWhiteSpace(boxPicker))
{
var boxList = boxPicker.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);
var calloutBox = Umbraco.TypedContent(boxList);
if (calloutBox != null)
{
foreach (var piece in calloutBox)
{
var itemLink = piece.GetPropertyValue<dynamic>("itemLink");
<div class="feature-box" style="background-image: url(@Umbraco.TypedMedia(piece.GetPropertyValue<string>("itemBgImg")).Url);">
<div class="details">
<i class="@piece.GetPropertyValue("itemIcon")"></i>
<h3>@piece.GetPropertyValue("itemTitle")</h3>
<p>@piece.GetPropertyValue("itemOverview")</p>
<p><a href="@itemLink.url" target="@itemLink.target">Learn More</a></p>
</div>
</div>
}
}
}
}
Using a Multinode Treepicker within LeBlender
Hello,
I have a document type where have multiple properties (itemIcon, itemTitle, itemOverview, etc...) within it. I would like these "widgets" to be able to be used within the grid across different pages in the site - think sidebar promos, pre-footer promos, and so forth.
I've created a data type of "Feature Box" which uses the multinode treepicker, and then in the Grid Editor/LeBlender Editor I've added a property of "Feature Selector" that uses my feature box as the data type.
All is good where I can select the node that I want to load content from, but where I'm stuck now is how do I actually render those properties (the itemIcon, itemTitle, etc) within the view for the Feature Selector? I've tried going with
@item.GetValue("itemTitle")
andvar itemTitle = Model.Items.First().GetValue<dynamic>("itemTitle"); <p>@itemTitle</p>
with no success.Could anyone please help point me in the right direction?
Thanks!
I was able to figure this out after a lot of research combined with trial and error. Here is how I was able to get the properties from the content/document type:
I found that this also works when dealing with MNTPs which have been added as properties to a LeBlender Grid Editor:
In v7.10 this works
is working on a reply...