Custom Display Types

Topics: Administration, Customizing Orchard
Feb 23, 2015 at 9:48 AM
4 display types that I came across are:
  • Detail
  • Summary
  • DetailAdmin
  • SummaryAdmin
Now views can be rendered by giving the content and display type name from other views like:
@Display(BuildDisplay(content, "Summary"))
How can I define custom DisplayTypes like "Summary","Detail" etc and use the above code line to Build my custom view shape??
Feb 23, 2015 at 10:25 AM
You can create custom displaytypes really easy:
  1. Create a view of your item you want controller over, and prefix it with your custom display type. E.g. : MyCustomContentType.MyCustomDisplayType.cshtml
  2. Call it with @Display(BuildDisplay(content, "MyCustomDisplayType"))
  3. Add lines for your custom display type:
    <!-- Custom display type placement -->
    <Match DisplayType="MyCustomDisplayType">
        <Place Parts_Title="Content:1" /> 
Marked as answer by TahirRauf on 2/23/2015 at 5:04 AM