This project is read-only.

How to enable Custom Display Types.

Topics: Writing modules
Sep 23, 2013 at 3:06 AM
Edited Sep 23, 2013 at 3:20 AM
I trying to use a custom display type for a content item but cannot seem to get it to use the expected view (.cshtml). Eventually I want to be able to overload this custom view within themes.

Here are the details:
  • Use a Projection Layout that renders a display type other than Detail and Summary, these are used in other places of the site.
  • I have the custom display type in
  • I have the view parts\Test.MiniSummary.cshtml but seems to be using the parts\Test.Summary.cshtml (I can see this in Shape Tracing)
  • Correct display type is being passed to the driver.
Here is the basic return from the driver
        return this.Combined(
            () => shapeHelper.Parts_Test(Test: viewModel)),
            () => shapeHelper.Parts_Test_MiniSummary(Test: viewModel)),
            () => shapeHelper.Parts_Test_SummaryAdmin(Test: viewModel)),
            () => shapeHelper.Parts_Test_Summary(Test: viewModel)));
Any clue on this issue if greatly appreciated.
Sep 23, 2013 at 3:09 AM
You did not say what your display type is named.
Sep 23, 2013 at 3:13 AM
The DisplayType is MiniSummary.
Sep 23, 2013 at 3:49 AM
The other interesting thing. If I force it to use a particular ContentShape the results are very odd.
            if (displayType.Equals("MiniSummary"))
                return this.ContentShape(
                    () => shapeHelper.Parts_Test_MiniSummary(Test: viewModel));
When I do this nothing is rendered and in Shape Tracing I get a shape of Content, which is not at all expected. In all cases in the Tracing tool I see Display Type MiniSummary so that seems to be set correctly.
Sep 23, 2013 at 4:06 AM
The Content shape is normal and expected, and the Combined shape really is what you want to do. Please show your placement file.
Sep 23, 2013 at 4:24 AM
Edited Sep 23, 2013 at 4:24 AM
Thanks so much your question sparked the answer the issue was indeed All I needed was to add the MiniSummary version of the result.

Here was the fix:
    <Match DisplayType="MiniSummary">
      <Place Parts_Test_MiniSummary="Content:1"/>
Sep 23, 2013 at 4:37 AM
Cool :) Custom display types are an underused and wonderful feature. Have fun!
Sep 23, 2013 at 5:59 AM
Thanks so much this solves a somewhat big issue with a site I am responsible for, very good way to end a weekend :).