I have a Projection Widget that displays a content type in the AsideSecond zone. I used Placement.info to suppress most of the metadata.
On the main page for that content type I want all the metadata displayed in the Content zone.
I cannot seem to work out how to specify an alternate template based on where the Shape is being rendered. They both have a display type of Summary. Everything I attempt applies the suppression/alternate template to both.
As these are threads which will be added as the forum is used I cannot use the ID alternate as a viable option.
My relevant placement:
<Match ContentType="Thread">
<Match DisplayType="Summary">
<Place Parts_Common_Metadata_Summary="-"/>
<Place Parts_Threads_Thread_ThreadReplyCount="-"/>
<Place Forum_Metadata_First="-"/>
</Match>
</Match>
I have tried nesting the Place
elements under a <Match ContentType="Widget">
element, but to no avail.
Is this even possible?
Update: I created a Shape layout on the query used in the projection widget. I created my own list shape in the theme Views folder and can access the relevant properties I need with a bit of casting. So, I can work around my issue.
I would still like to know if it is possible to set an alternate based on the zone or whether the content is rendered in a widget. I have seen several, mostly unanswered, questions on SO regarding this (e.g. How to suppress parts in Orchard based on zone)
My question was answered on the Orchard discussion forum.
The challenge is that you can't easily know what zone your part shapes are being rendered in. If you wanted to add alternates to the Widget shape then that would be easy, since widgets know to which zone they belong.
So the short answer is: no, not out of box. However, you could implement an
IShapeTableProvider
and describe theWidget
shape. This shape will contain a reference to the ContentItem (which will have a WidgetPart attached through which you can access the zone name it belongs to) and child shapes (including shapes likeParts_Title_Summary
), so you could walk this shape tree and add alternates to each based on the zone name.Not pretty, but it could work.
So it is not a simple alternate naming or placement solution. I feel the best plan of action is to write ones own layout for a query if you are attempting to use the same ContentType and DisplayType across zones. Hope this helps someone.