Reputation: 49
I starting with orchard. I want to override MenuWidgetPart to render as i want. I've created Parts.MenuWidget-MenuWidget.cshtml into Views folder of current theme. But i do not know, how to i can get list menu from Model. Please look my code below:
<nav>
<ul>
@foreach(var m in listMenu){
<li><a href="#">@m.Text</a></li>
}
</ul>
</nav>
How to i can get listMenu from Model ?
Upvotes: 0
Views: 998
Reputation: 4763
Templates for Menu
and MenuItem
are Menu.cshtml
and MenuItem.cshtml
. You can start by copying those files from /Core/Shapes/Views/
directory to your theme directory. You can modify them as you wish afterwards.
This will, actually modify all your menus on the site. If you want it to be specifically for your widget (Parts.MenuWidget-MenuWidget.cshtml
) you can start by copying the contents from Menu.cshtml
to your widget template and continue with modifications from there.
EDIT:
To iterate over items you can use the following syntax:
@foreach (var item in Model.Menu.Items){
@Display(item)
}
Upvotes: 3