IMenuProvider - add menu items to Main Menu only

Topics: General, Troubleshooting, Writing modules, Writing themes
Aug 30, 2014 at 12:53 AM
I'm creating a class to drop in the root of my theme that implements IMenuProvider so I can add items to the Main Menu.

The method GetMenu passes in a IContent object named menu. Does anyone know how I can create an if statement to ONLY add the items if the menu is the Main Menu? I can create an if statement using menu.Id, but I'd like to get back to menu name and use that instead.

Thanks for any assistance.
Aug 30, 2014 at 2:46 AM
Got it figured out...
if (menu.As<TitlePart>().Title == "Main Menu") {
...
}
menu is IContent
Marked as answer by psenechal on 9/5/2014 at 12:12 PM