Customising SetupMode

Topics: Writing modules
May 31, 2011 at 10:00 PM

I've been digging around in the source for Orchard.Setup in an attempt to find a way of customising the setup mode. SetupMode appears to be an Autofac module that is loaded when you visit a fresh site - but what part of Orchard decides if it should be loaded? Is there any mechanism to allow a developer to create their own derivative of Autofac.Module and have that loaded at the same time, perhaps overriding Load() and registering an alternative theme selector?

Coordinator
May 31, 2011 at 11:26 PM

Look into Orchard.Environment.DefaultOrchardHost.CreateShellContext: when the tenant state is uninitialized, we create a setup context.

Jun 1, 2011 at 11:04 AM

What do you want to customise about setup? Have you looked at Recipes?

Jun 1, 2011 at 11:54 AM

@bertrand - Thanks for that, makes a little bit more sense now. Would I be correct in thinking that because the list of features in the descriptor passed to the composition strategy in CreateSetupContext is hard-coded, there is no way of getting another module in there without patching the Orchard source?

@randompete - I'd like to override the SafeModeThemeService defined in SetupMode or override the SafeMode theme in SetupMode via some other means (I'm not sure if we could do that with a recipe since it needs to override the theme before the site configuration starts). I'd like to do this, if possible, without having to create a patch for Orchard.Setup or anything hacky like that but as I mentioned above it doesn't look possible (from reading through ShellContextFactory, CreateShellContext and CreateSetupContext).

Oh and good job on Science Project by the way, very interesting project, I've been keeping an eye on it.

Jun 1, 2011 at 4:06 PM

Sounds like you might have to just modify the Setup module directly - on a repository clone of course - if there are no extensibility points for the SafeModeThemeService. Unless there's any way of enabling additional modules during Setup, in which case you could probably use OrchardSuppressDependency.

Thanks for your comments about Science Project; it's been really interesting to build, and to be honest I'm starting to achieve some very cool stuff as I'm playing around with it :) Right now I'm finishing off the routing engine and I'll be about ready for a 1.0 beta and can start showing off some decent examples!

Coordinator
Jun 1, 2011 at 6:16 PM

Right, there is no way you can modify the "setup setup" without going into the code at the moment. I'll keep the scenario in mind. We have other reasons to open up that part, like allowing for other setup languages so this might be changed sometime in the future.