IOrchardServices new shape question

Topics: Customizing Orchard, Writing modules
Mar 17, 2014 at 7:12 PM
var shape = _services.New.ReallyCoolShape();

so i want to do something like this, which works fine if my ReallyCoolShape.cshtml is at the root of my views folder in my module. Now if I wanted to put that file in a sub folder, say CoolShapes, then it is not able to find my shape as is in above code. The dynamic nature of this function call makes it hard for me to understand what is going on so I can access the shapes I want. As, a side note if I have an index.cshtml in the CoolShapes subfolder, my CoolShapesController finds the correct index.cshtml.

Thanks in advance for you input.
Developer
Mar 17, 2014 at 10:25 PM
This is normal behaviour. The thing is that to find a shape template Orchard has to try to load it from a variety of locations; if it would also deal with subfolders this load would be huge. Nevertheless we could use some naming convention (like it is for parts: Parts_My can map to Parts.My and Parts/My too) for all shape templates to enable such "namespacing".
Coordinator
Mar 17, 2014 at 10:35 PM
The list of searched locations is actually overridable. It's a finite set of folders, look for 'items', 'parts' and 'views' and you should find it easily.
Mar 17, 2014 at 11:51 PM
would that be using the IShapeTemplateHarvester?
Coordinator
Mar 18, 2014 at 12:29 AM
Correct