I’m sure this must have been asked before. but I’ve been unable to find anything helpful.
I want to create some widgets (existing widget types, a menu, a projection), as part of a custom module install. aslo some queries and Projection pages.
as well as a new menu (orchard 1.5.1), I figured out the menu part form the code in the setup module
…
// create a project menu
var projectMenu = _menuService.Create("new Menu");
// assign the project items to all current menu items
foreach (var menuItem in _menuService.Get().Where(x => x.ContentItem.ContentType == "Project"))
{
// if they don't have a position or a text, then they are not displayed
if (string.IsNullOrWhiteSpace(menuItem.MenuPosition) || string.IsNullOrEmpty(menuItem.MenuText))
{
continue;
}
menuItem.Menu = projectMenu.ContentItem;
Can I include something in my migration to add the widgets and projections ?
I’ve been looking at the Orchard Recipe module, and see there is code there for executing commands to set up widgets. But I’m not sure how best to tap into this…
Creating an instance of recipe manages and executing a whole recipe seem a bit convoluted.
There are some quite useful seemingly undocumented services all over the place you can use.
With the following constructor
Auto fac will take care of instantiating the services
then
there is a similar service for Queries, but I’m stil not sure how to add filters to queries, for projections…
UPDATE
heres how you can add a query and filter