This project is read-only.

Edit ContentType Media Picker Field

Topics: Administration
Sep 25, 2012 at 4:22 PM


I add two fields Media Picker Field.

The first one has the purpose to display a picture from the image Gallery

The second has the purpose to display a picture from a url website.

I use Visual Studio to build and start the website.

I notice for the fist one by using developper tool from chrome I have displayed

Picture 1 : ~/Media/Default/ImageGalleries/Ebook/lesgrottesdekalteBig.jpg

With a source html

span class="value" shape-id="10">~/Media/Default/ImageGalleries/Ebook/lesgrottesdekalteBig.jpg</span>

And for the Picture 2

I see nothing exept Picture 2

<span class="name" shape-id="11">Picture2:</span>

The two are included in a <p> with the class media-picker-field media-picher-field-picture-

In the administration part I can see for 

Picture 1 : ~/Media/Default/ImageGalleries/Ebook/lesgrottesdekalteBig.jpg

Picture 2 :

Do you have any idea? (I am trying to use iis instead casini from visual studio 2010)

Best regards,


Sep 25, 2012 at 5:06 PM

I think I need to investigate the two links below to understand it

So I continu to search :)


Sep 25, 2012 at 5:41 PM

Override the template in your theme. For example, Views/Fields/MediaPicker-NameOfYourField.cshtml:

@using Orchard.Utility.Extensions;
    string name = Model.ContentField.Name;
    string url = Model.ContentField.Url;
@if (!String.IsNullOrWhiteSpace(url)) {
    <a href="@Href(url)" target="_blank"><img src="@Href(url)" alt="@Model.ContentField.AlternateText" class="media-picker-field media-picker-field-@name.HtmlClassify()"/></a>
@* Other available properties

    Alternate Text: @Model.ContentField.AlternateText
    Class: @Model.ContentField.Class
    Style: @Model.ContentField.Style
    Alignment @Model.ContentField.Alignment
    Width: @Model.ContentField.Width
    Height: @Model.ContentField.Height

Sep 25, 2012 at 8:41 PM


Thank you, I modify the theme according to your recommandations.

In the link Placement-Info, I notice "A theme author can then provide a Parts/Tags.ShowTags.BlogPost.cshtml file that customizes the display of tags for blog posts."

So If I understand, each time I would like to customize a display from a fields provided from a content Type I need to use the Views/Fields/NameOfContentType-NameOfYourField.cshtml Is-it right? 

I really need to go further in the knowledge. Sorry but I am just beginning :)

Is there any documentation or link related to your proposal, I dont find anything in the previous links indicated the MediaPicker-NameOfYourField.cshtml (from previous post).

Best regards,


Sep 26, 2012 at 12:23 AM

Almost, except it's Views/Fields/NameOfFieldShape-NameOfField.cshtml. I think this is the topic you're looking for:

Sep 26, 2012 at 5:01 AM
bertrandleroy wrote:

Almost, except it's Views/Fields/NameOfFieldShape-NameOfField.cshtml. I think this is the topic you're looking for:

I recommend enabling shapetracing module to get additional experience with alternates.  It will create a great popup at the bottom which will show you alternates available for your widget/content or single fields.  You'll also want to understand the files which can help you figure out where the fields will display in your content item.

Sep 26, 2012 at 8:50 AM


thank you corecomps/

I use shape tracing module and I understand how bertandleroy found a sample of code.

Effectively, in, when I click on Template I found a sample of code related to ~/Modules/Orchard.Fields/Views/Fields/MediaPicker.cshtml.

Thanks bertrandleroy, it answered to my question.

Best regards,