Skip to content

Commit c4810bd

Browse files
committed
Added mediapicker3 support
Added mediapicker3 support for Umbraco 8.14 >
1 parent 6b41f04 commit c4810bd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

MetaMomentum.Umbraco/App_Plugins/MetaMomentum/editorView.controller.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,26 @@ angular.module("umbraco")
232232
if (typeof properties[p].value !== "undefined" && properties[p].value !== "" && properties[p].value !== null) {
233233
//Found a fallback property value
234234
console.log("fallback", properties[p])
235-
$scope.model.value.shareImage = properties[p].value;
235+
$scope.model.value.shareImage = properties[p];
236236

237237

238-
if ($scope.model.value.shareImage != null && $scope.model.value.shareImage.startsWith("umb://")) {
238+
if ($scope.model.value.shareImage.view == "mediapicker" && $scope.model.value.shareImage.value != null && $scope.model.value.shareImage.value.startsWith("umb://")) {
239239
//The fallback is a media picker
240+
entityResource.getById($scope.model.value.shareImage.value, "Media")
241+
.then(function (mediaEntity) {
242+
$scope.model.value.shareImageUrl = mediaEntity.metaData.MediaPath;
243+
});
244+
} else if ($scope.model.value.shareImage.view == "mediapicker3" && $scope.model.value.shareImage.value.length > 0) {
245+
//The fallback is a media picker
246+
$scope.model.value.shareImage = properties[p].value[0].mediaKey
240247
entityResource.getById($scope.model.value.shareImage, "Media")
241248
.then(function (mediaEntity) {
249+
console.log(mediaEntity);
242250
$scope.model.value.shareImageUrl = mediaEntity.metaData.MediaPath;
243251
});
244-
} else if ($scope.model.value.shareImage.startsWith("/")) {
252+
} else if ($scope.model.value.shareImage.value.startsWith("/")) {
245253
//Probably an upload field. Could be another random property too, so be careful
246-
$scope.model.value.shareImageUrl = $scope.model.value.shareImage;
254+
$scope.model.value.shareImageUrl = $scope.model.value.shareImage.value;
247255
} else {
248256
//Not a property with a valid source image
249257
$scope.model.value.shareImageUrl = null;

0 commit comments

Comments
 (0)