When would you override the importing/exporting methods?

Topics: Writing modules
May 20, 2011 at 4:45 AM

I'm learning how to write modules by looking at other modules' code in Orchard. A number of things still confuse me about Orchard development, particularly areas, routing, the placement.info file and shapes produced by the drivers and views. Really how all these things interact. When I change stuff like the placement.info file it seems to screw up my custom routes. Ok I've gone off topic

I haven't learned much asp mvc so that is likely part of the problem. But the thing I want to know most of all is why some modules override the importing/exporting methods in their drivers and others don't?

May 20, 2011 at 11:43 AM

I think very basically it's because Import/Export was only recently added and not all modules have caught up yet ;)

May 20, 2011 at 11:53 AM

Regarding the other stuff you mention; I have no idea why modifying placement.info would screw up anything to do with routing; they're completely unrelated, unless you're using Url Alternates in which case there is a very tenuous connection. Perhaps you can give a specific example of what you're changing that's messing things up?

The thing to understand is, Placement.info will only affect shapes emitted from ContentPartDrivers. This is because placement is performed partly by the DriverResult, and partly by the content driver coordinator.

I've actually spent a bit of time writing a system that allows you to use Placement.info in other situations. It basically replicates a lot of what the drivers system does, but for other arbitrary models (not just content items). It's been quite interesting to play around with. I'm using it for various composable UI scenarios in Science Project and Media Garden. Currently it's only available on a fork of Science Project but it'll be releasable soon.

May 21, 2011 at 2:26 AM

Thanks Randompete, it must be something else that is affecting my routing. I've been trying to develop a forum module but for some reason at some point in its development the  route for creating new forum topics stopped working and after some frustrating trial and error work the fix ended up being to change the route's area to 'Forum.Topic' instead of just 'Forum' for the Create action in the forum's Topic controller. The strange thing is that creating new Threads which lie underneath Topics still works fine with the route area set to 'Forum' not something like 'Forum.Threads'.

I thought it might be affected by placement.info since that was the last thing I changed. I think I might have to start writing unit tests for all this stuff so I can figure out what's affecting what.

Would still like to know exactly what Importing/Exporting methods are doing though?