Match ContentType="ContainerWidget"?

Topics: Customizing Orchard, Writing modules, Writing themes
Jun 27, 2011 at 12:20 AM

Please whoever know it  just clarify to me the following :

In Documentation:

"Match" Element

<... ContentType. Scopes the contained Place tags to a specific content type (such as BlogPost or Page) or stereotype (such as Widget; this feature is new to Orchard 1.1).  ..>

It seems just exactly what I need : to filter just by Widget of ConatinerWidget sort of like this

  <Match ContentType="ContainerWidget">
    <Place Fields_MediaPickerField-Image1="-"/>
    <Place Fields_MediaPickerField-Image3="-"/>

But it does not work!? What is wrong in my seeing it?



Jun 27, 2011 at 3:11 AM

Maybe the field does not handle it. Which MediaPickerField are you using, there are two on the gallery, and I know mine is handling it.

Jun 27, 2011 at 11:06 AM

Hi Larry,

The problem is that you're matching the container shape; but what the container widget then does is render a Summary list of other content items. It's those items that you need to hide the fields from. So you probably need to match DisplayType="Summary", rather than the content type.

Sep 13, 2013 at 7:21 PM
So, can we alternate Fields_MediaPickerField for different zone (or container widget).
Is there some ways?
I have read about placement, Alternates, shape. But I still have no solution here.
Any help.
Sep 13, 2013 at 7:48 PM
I mean,
Ex: my widget struture:
container widget > articles > mediapickerfields

I have 2 widgets in featured zone and content zone. So how to alternate display template of mediapikerfields for that 2 zone.
The default template as following: (but chage it will effect to all container widgets.)
@using Orchard.ContentManagement
@using Orchard.MediaLibrary.Models
    ImagePart imagePart = Model.ContentPart;
    var mediaPart = ((ContentItem)Model.ContentItem).As<MediaPart>();

@* Use a 200x200 profile in order to reuse the general thumbnail *@
<h2>Ngiyen kfadfa f</h2>
<a href="@Url.Content(mediaPart.MediaUrl)">
    <img width="500" height="500" alt="@mediaPart.AlternateText" src="@Display.ResizeMediaUrl(Width: 500, Height: 500, Mode: "crop", Alignment: "middlecenter", Path: mediaPart.MediaUrl)" />
any help?