Possible to execute module "Recipe" when Module installed?

Topics: Writing modules
Nov 22, 2011 at 8:20 AM

We are developing a series of base modules/components for our application framework. Some of our framework components include a Module Registry, a custom menu system, and a handful of other services. 

When a new "Application" module is installed (that we build), we want it to be "self-configuring" and put itself in the appropriate place within the application framework (i.e if I add a Notepad application module, it would know to place itself in a particular zone on a particular Layer, and add it's registration settings to our core components, add a menu item in the appropriate part of the menu etc....It would also create a couple/few pages and potentially add some content.)

Now using Recipes, we've been able to do most of this in our initial tests, but the problem is that it would appear the recipes can only really be executed once on startup of Orchard, and it doesn't appear to be the kind of thing that can/should be executed in the way we are describing. 

What would be the best programmatic way for a module to "Self configure on first-run?"...as well as the best way to create pages and content in the way I described.... 

Gracias

R

Developer
Nov 22, 2011 at 11:03 AM

Have a look at Vandelay Industries module, for a feature it uses a recipe to make various configurations. Such recipes can be run together when enabling a feature.

Nov 22, 2011 at 1:02 PM

You could probably also write a new module that exposed a recipe menu for running them after a feature is installed.