Overriding a Driver in Orchard.Core to add functionality

Topics: Customizing Orchard
Jul 16, 2014 at 8:23 PM
I'm trying to edit the MenuPart with the end goal of being able to set the menu position of a content item from the editor. The site I am building features some very large menus, so dragging and dropping each page into the correct position can be quite tedious and presents a decent risk of someone dropping a page in the wrong place.

I was able to add the functionality I wanted by adding a few lines to files in the Orchard.Core/Navigation area, but was wondering if there was a way to override the changed files (MenuPartDriver.cs, MenuPartViewModel.cs, and Parts.Navigation.Menu.Edit.cshtml) from a theme or module. Overriding the EditorTemplate is easy enough, but I'm not sure how I would go about overriding the driver or ViewModel.

An older discussion (https://orchard.codeplex.com/discussions/258197) mentioned that overriding drivers with SuppressDependency was a possibility, but I'm not sure if this would still be relevant or not.
Oct 9, 2014 at 10:13 PM
I know this is old, and you may have already solved your issue - but I figured I would add this for anyone that wants to do something similar.

To override Driver/Display you can just "replicate" the files you are interested in to a new (or existing) module. You do not need to use SuppressDependancy.

Once you have done this edit the module.txt file to add Navigation to dependencies: (ex from PublishLater module)
Dependencies: Common, Scheduling

Rename the view to something like Parts.CustomNavigation.Menu.Edit.cshtml, make sure to update the driver to call this template instead of the default one.

You will then need to add the following in your placement.info file:

<Place Parts_Navigation_Menu_Edit="-"/>
<Place Parts_CustomNavigation_Menu_Edit="Content:9"/>

Justin