user1723409
user1723409

Reputation: 133

Create link to Edit navigation in orchard

when you hit edit in orchard for a menu it takes you to the widget. I am trying to figure out how to make the edit link go to the specific navigation that the menu widget holds.

Upvotes: 0

Views: 53

Answers (1)

Piotr Szmyd
Piotr Szmyd

Reputation: 13366

You can alter default Display/Edit/Remove links for any content item by using OnGetContentItemMetadata method inside a content handler.

In your specific example, making edit link for a widget to point to the underlying menu editor would look like:

public class MyHandler : ContentHandler
{
    public MyHandler()
    {
        OnGetContentItemMetadata<MenuWidgetPart>((ctx, part) =>
        {
            ctx.Metadata.EditorRouteValues = new RouteValueDictionary
            {
                { "Area", "Navigation" },
                { "Controller", "Admin" },
                { "Action", "Index" },
                { "menuId", part.MenuContentItemId }
            };
        });
    }
}

Upvotes: 1

Related Questions