This project is read-only.

Purpose of BuildDisplayShape

Topics: General, Troubleshooting
Nov 8, 2011 at 10:15 AM

Can someone tell me why would u use BuildDisplayShape instead of the default way BuildDisplay and using Display method of a Driver?

Nov 8, 2011 at 11:25 AM

As far as I'm aware, BuildDisplayShape is a method my Origami module provides, and nothing to do with Orchard core. It's for building displays from any kind of model, whereas Orchard's BuildDisplay will only build ContentItem displays.

BuildDisplayShape uses its own form of driver, ModelDriver<T>. I use it extensively in various parts of Science Project and Media Garden to build displays from arbitrary models and records, making the whole thing as extensible as the normal content pipeline.

Unless I'm missing something and there's a BuildDisplayShape elsewhere in Orchard?

Nov 8, 2011 at 8:36 PM

see the Orchard.ContentManagement.Drivers.Coordinators.ContentFieldDriverCoordinator

or Orchard.ContentManagement.Handlers ContentHandler

Nov 9, 2011 at 1:48 PM

I don't see "BuildDisplayShape" in ContentFieldDriverCoordinator.

In ContentHandler, it's an override of a method of TemplateFilterBase<TPart>. It gets called during the whole BuildDisplay pipeline. It's not something you would ever call yourself, although it's a process you can hook into when you override OnGetDisplayShape in your content handler.

Sometimes you'll want to use a ContentHandler if you can't do what you need from a driver. But it's all part of the same process anyway.