Single image picker for Umbraco 7

1.4k Views Asked by At

Im not sure if Im missing something here.. but when I create a new data-type called Single Media Picker in umbraco 7 and uses the new Media Picker-property editor and keep the "multiple selections option" unchecked.. I am still able to select multiple images in the media picker-dialog..and once selected.. they all show up in my property-filed as well.. any ideas of why?.. guess its a bug in Umbraco.. and if thats the case.. anyone have a clue of how to limit the media-picker to a single selection for my own custom property editor?

Thanks in advance!

1

There are 1 best solutions below

0
On

It depends a bit on how you use the media picker in your custom property editor. We're using the media picker in a completely separate tree for which we generate the JSON that yields the editor ourselves.

The property data that generates a single item picker looks a bit like this:

{
    "label" : "Some Image",
    "description" : "423 x 258px",
    "view" : "mediapicker",
    "config" : {
        "multiPicker" : "0"
    },
    "hideLabel" : false,
    "id" : 4,
    "value" : "1092",
    "alias" : "imageIdProperty"
}

Notice the config section. You could try to inspect the data that goes to the client and see what JSON is used to generate your picker.