I have added "description" as a Vorto-wrapped TextString on a custom media type called vimeovideo. Hence, I can specify a description for a video in multiple languages. There is also a downloadLink, which is not wrapped with vorto.
When I want to show a list of videos, I use this
var productVideosList = Model.Content.GetPropertyValue<string>("videos").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);
var productVideosCollection = Umbraco.TypedMedia(productVideosList).Where(x => x != null);
foreach (var productVideo in productVideosCollection)
{
if (productVideo.HasValue("downloadLink"))
{
var destinationUrl = productVideo.GetPropertyValue<string>("downloadLink");
var desc = productVideo.HasVortoValue("description") ? productVideo.GetVortoValue("description") : productVideo.Name;
<li><a href="@destinationUrl" target="_blank"><i class="fa fa-video-camera"></i> @desc </a></li>
}
}
But I get the error:
CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'HasVortoValue' and no extension method 'HasVortoValue' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found
What am I doing wrong here? Probably something with the productVideo instance not being of the correct type, but I can't figure it out.
OK - so I started fiddling around with casting to IPublishedContent, and suddenly the posted code above works. No errors. Very, very strange. Can this somehow be related to "publishing" a media item?
HasVortoValue not working on a media item
Hi
Umbraco 7.2.6 and Vorto 1.4
I have added "description" as a Vorto-wrapped TextString on a custom media type called vimeovideo. Hence, I can specify a description for a video in multiple languages. There is also a downloadLink, which is not wrapped with vorto.
When I want to show a list of videos, I use this
But I get the error: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'HasVortoValue' and no extension method 'HasVortoValue' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found
What am I doing wrong here? Probably something with the productVideo instance not being of the correct type, but I can't figure it out.
Any ideas?
Best regards Jan
OK - so I started fiddling around with casting to IPublishedContent, and suddenly the posted code above works. No errors. Very, very strange. Can this somehow be related to "publishing" a media item?
is working on a reply...