简体   繁体   English

Umbraco 7的单个图像选择器

[英]Single image picker for Umbraco 7

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? 我不确定我是否在这里遗漏了一些东西。但是当我在umbraco 7中创建一个称为Single Media Picker的新数据类型并使用新的Media Picker属性编辑器并保持未选中“多选选项”时。在媒体选择器对话框中选择多个图像,然后选择它们。它们全部也显示在我的属性文件中。为什么有任何想法?猜测它在Umbraco中的错误。 ..有人知道如何将媒体选择器限制为我自己的自定义属性编辑器的单一选择吗?

Thanks in advance! 提前致谢!

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. 我们在完全独立的树中使用媒体选择器,为此我们生成了生成编辑器的JSON。

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. 您可以尝试检查传递给客户端的数据,并查看使用什么JSON生成选择器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM