relationship IShapeFactoryEvents and Feature?

Topics: Writing modules
Feb 17, 2011 at 6:37 PM

I'm looking at "public class Shapes : IShapeFactoryEvents" in module Orchard.Experimental.

Why is this class only used when feature 'Orchard.Experimental' is enabled? Since the module contains more than feature: Why is this related?

For other features like 'Orchard.Experimental.WebCommandLine' there is an explicit attribute being used on Orchard.Experimental.Controllers.CommandsController: '[OrchardFeature("Orchard.Experimental.WebCommandLine")]' -- so what implicit relationship is there?

Coordinator
Feb 17, 2011 at 8:31 PM

I'm sorry but I'm having trouble understanding the question. If you're asking how enabling and disabling features affects the code that you can call, well the code itself is always there, but whether it can be injected through IoC is affected. The OrchardFeature attribute helps declaring that.

Feb 17, 2011 at 10:01 PM

But there is no OrchardFeatureAttribute applied to the Orchard.Experimental.Shapes class. That's exactly the question: Why depends this on enabling feature Orchard.Experimental (one of many features inside the very same module)?

Coordinator
Feb 17, 2011 at 10:08 PM

That is probably an oversight. The Experimental module is experimental.

Feb 17, 2011 at 10:24 PM

Of course it's experimental ;)

But since Orchard.Experimental.Controllers.ShapeTableController also has no OrchardFeatureAttribute, but also requires the "Orchard.Experimental" to work: Is there a rule which implicitly assigns the first listed feature in Module.txt if there is no explicitly written OrchardFeatureAttribute? Or is there some other magically matching rule?

Coordinator
Feb 17, 2011 at 10:32 PM

Ah, yes, each module has a default feature that has the same name as the module.

Feb 18, 2011 at 12:20 AM

I'm puzzled: When you say "name" you don't mean what appears after "Name: " but more likely "ID" (module folder name / feature node in Module.txt)? Because what is named "Name: " in Module.txt seems to be just a UI friendly caption/title?

Coordinator
Feb 18, 2011 at 12:22 AM

Yes, my bad.

Feb 18, 2011 at 9:04 AM

Does there exist a real detail reference for Module.txt or Placement.info, yet? (I found none.)

While playing around I found out: At least "Name: " for the module is not only used for a "UI caption" but also defines the route to the controllers+views (so you should not use spaces in there, should you?).

Coordinator
Feb 18, 2011 at 8:20 PM

You are right and that was fixed recently (see http://orchard.codeplex.com/workitem/17269).

There is no reference document for those, but it's high on the list. Thanks for the feedback.