5
5
#if NETCOREAPP
6
6
using Umbraco . Cms . Core . Models ;
7
7
using Umbraco . Cms . Core . Models . PublishedContent ;
8
+ using Umbraco . Extensions ;
8
9
#else
9
10
using Umbraco . Core . Models ;
10
11
using Umbraco . Core . Models . PublishedContent ;
12
+ using Umbraco . Web ;
11
13
#endif
12
14
13
15
namespace Umbraco . Cms . Integrations . Automation . Zapier . Extensions
@@ -33,7 +35,10 @@ public static Dictionary<string, string> ToContentTypeDictionary(this IContentTy
33
35
34
36
var contentProperty = content . Properties . First ( p => p . Alias == propertyType . Alias ) ;
35
37
36
- contentDict . Add ( propertyType . Alias , contentProperty . GetValue ( ) . ToString ( ) ) ;
38
+ if ( IsMedia ( contentProperty , out string url ) )
39
+ contentDict . Add ( propertyType . Alias , url ) ;
40
+ else
41
+ contentDict . Add ( propertyType . Alias , contentProperty . GetValue ( ) . ToString ( ) ) ;
37
42
}
38
43
39
44
return contentDict ;
@@ -55,5 +60,23 @@ public static Dictionary<string, string> ToContentDictionary(this IContent conte
55
60
56
61
return contentDict ;
57
62
}
63
+
64
+ private static bool IsMedia ( IPublishedProperty contentProperty , out string url )
65
+ {
66
+ switch ( contentProperty . PropertyType . EditorAlias )
67
+ {
68
+ case Core . Constants . PropertyEditors . Aliases . MediaPicker :
69
+ var mediaPickerValue = contentProperty . GetValue ( ) as IPublishedContent ;
70
+ url = mediaPickerValue . Url ( ) ;
71
+ return true ;
72
+ case Core . Constants . PropertyEditors . Aliases . MediaPicker3 :
73
+ var mediaPicker3Value = contentProperty . GetValue ( ) as MediaWithCrops ;
74
+ url = mediaPicker3Value . LocalCrops . Src ;
75
+ return true ;
76
+ default :
77
+ url = string . Empty ;
78
+ return false ;
79
+ }
80
+ }
58
81
}
59
82
}
0 commit comments