orchardcms

Orchard field mediapicker field placement


I created a ContentType (named Trainer) using the interface and used a media picker field to input the trainer's photo besides a text field for trainer's current position and 2 parts(Title and Body) to define other info.

When browse the trainers and go to the details of the trainer the photo appears at the end of all other fields and I cannot find howto use placement.info to have the photo be displayed on top of all the fields and other parts.


Solution

  • These are the default rules in Orchard.MediaLibrary:

    <Match DisplayType="Detail">
        <Place Fields_MediaLibraryPicker="Content:after"/>
    </Match>
    
    <Match DisplayType="Summary">
        <Place Fields_MediaLibraryPicker_Summary="-"/>
    </Match>
    
    <Match DisplayType="SummaryAdmin">
        <Place Fields_MediaLibraryPicker_SummaryAdmin="Content:after"/>
    </Match>
    

    So in your case it would be:

    <Match ContentType="Trainer">
        <Place Fields_MediaLibraryPicker="Content:before" />
    </Match>
    

    Or, when you might add multiple medialibrarypicker fields in the trainer content type:

    <Match ContentType="Trainer">
        <!-- Photo is the name of your field in this case -->
        <Place Fields_MediaLibraryPicker-Photo="Content:before" />
    </Match>
    

    Enable the shape tracing module to easily find out how to target the field:

    http://docs.orchardproject.net/Documentation/Customizing-Orchard-using-Designer-Helper-Tools

    http://docs.orchardproject.net/Documentation/Understanding-placement-info