0
votes

I have a custom ContentPart as well as an editor view under Views/EditorTemplates/Parts/ folder. I am trying to figure out the appropriate DisplayType value to use in my placement.info file to get this view to kick in. I see it show up if I use something like this:

<Match ContentType="MyType">
  <Place Parts_MyPart_Edit="Content"/>
</Match>

But I'd like to be able to target it a little more explicitly like:

<Match ContentType="MyType">
  <Match DisplayType="????">-->
    <Place Parts_MyPart_Edit="Content"/>
  </Match>
</Match>

I have tried "Detail", "Summary", and "SummaryAdmin" unsuccessfully.

So 2 questions:

  1. Is there a standard list of "DisplayType" values documented somewhere?
  2. Is there a way to discover what the "DisplayType" is at runtime via a breakpoint or otherwise so that I can further restrict it in the placement.info?

Edit

Thinking about this a bit more, is 'DisplayType' even involved when Editor templates are used? I just realized that Parts_MyPart_Edit may be restrictive enough since it is already targetting _Edit. Is this right, or is there also an option to match on 'DisplayType' that can be used for editor templates?

2
You're not saying where that Views folder is. Is it in a theme or in a module? Cause it won't work from a theme.Bertrand Le Roy
Sorry, it is in my module. Also to clarify, the template works fine if I don't restrict it with a <Match> element. I was just wanting to understand more how I could target the display type for an editor template.bingles
OK, well, no, you shouldn't use a match here: the name of the shape is already different.Bertrand Le Roy
Ok, that's what I was concluding. Just for my understanding, is there even a "DisplayType" at play when an part editor is loaded? Curious since the driver editor method doesn't have a displayType parameter.bingles

2 Answers

0
votes

1: Don't know exactly where the correct documentation is on this topic, but this is the correct syntax: <Match DisplayType="Summary"> Detail and SummaryAdmin are also valid display types.

Besides that, you can also define your own display type:

var shape = _contentManager.BuildDisplay(item, "CustomDisplayType");

Then your shapes/views must be named as YourShape.CustomDisplayType.cshtml. Then you can use your displaytype in placement.info:

<Match DisplayType="CustomDisplayType">
    <Place Parts_YourPart="Content:1" />
</Match>

2: Use the 'shape tracer' module. When enabled you can find in the front-end which display type is used.

You probably made a mistake with either the <Place Parts_ section or your part driver is not correctly implemented. Also check if your shape's name is correct.

0
votes

Posting this as an answer, since I don't have a high enough reputation to add comment yet :)

If you are interested in using Shape Tracer on admin pages, open up the ShapeTracingFactory.cs file in Orchard.DesignerTools module, and comment out the following line in the IsActivable method:

if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData()))) return false;

I have found this extremely useful for figuring out exactly what is happening during Content Authoring tasks