Annoyingly, the MediaData class in Episerver doesn't have any basic properties like source URL, alt text, etc. I'm trying to implement a class to inherit from MediaData and provide specific properties for a certain type of media asset (PDF in this example).
I've tried manually setting the property values and also overriding the SetDefaultValues event, to no avail. Although, I do see either a textbox or a URL picker based on the type I use for "SrcUrl", however it is blank and never populates the uploaded PDF's URL.
[ContentType(
DisplayName = "PDF File",
GUID = "xxxxxxx-xxxx-xxxxxx-xxxx-xxxxxxxxxxx")]
[MediaDescriptor(ExtensionString = "pdf")]
public class PdfFile : MediaData
{
[UIHint(UIHint.MediaFile)]
[Display(Name = "PDF URL",
Description = "Link to view or reference PDF",
GroupName = SystemTabNames.Content,
Order = 10)]
public virtual string SrcUrl
{
get { return UrlResolver.Current.GetUrl(this.ContentLink); }
set { value = UrlResolver.Current.GetUrl(this.ContentLink); }
}
// Sets the default property values
public override void SetDefaultValues(ContentType contentType)
{
base.SetDefaultValues(contentType);
this.SrcUrl = UrlResolver.Current.GetUrl(this.ContentLink) ?? "Default";
}
}
****Disclaimer: I'm new to the Episerver CMS and may be missing something stupidly simple (ok with being shamed if appropriate).*