My question is: simmalar questions / 10369967 / orchard-cms-how-to-add-media-picker-field-to-anew-module
I created a new piece of content that has a selection list, a text box, and ... I want to enable the media picker feed.
I added this to part of the content with Bertrand Le Roy's suggestion:
ContentDefinitionManager.AlterPartDefinition("Product", builder => builder.WithField("ProductImage", fieldBuilder => fieldBuilder .OfType("MediaPickerField") .WithDisplayName("Product Image")));
However, I do not know how to show this in my custom editor. View
I am sure that there should be something simple, like @Display (Model.ProductImage) ... but I watched the writing of part of the content form Orchard documents, and my model in my view of the editor is not dynamic.
So, if magic like @Display (Model.ProductImage) exists, how do I add a media select item to my view model?
Update
The Media Select box appears to be displayed in the types of content where I add this part, and not where I want it! I want to show / hide this field, shifted by the values ββselected from the selection list. How can I stop the default rendering of the Content Item field and display it in my user view?
Update 2
I added this to the model
public MediaPickerField MediaPicker { get{ return (MediaPickerField)((dynamic)ContentItem).HeaderPart.Image;} }
this is to mind
@Html.Partial("EditorTemplates/Fields/MediaPicker.Edit", Model.MediaPicker)
and this is place.info
<Place Fields_MediaPicker_Edit="-"/>
Now it looks correct when editing with cms end ... but it doesn't seem to save images in the database!