Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

Add arbitrary number of assets (pdf, doc, etc) as a property to a content type?

$
0
0

So I have this content type I set up. Each piece of content has a description and a few text fields, but I also need to allow for an arbitrary number of assets to be added. For example, a user needs to be able to add a PDF, then have the opportunity to add a second, third, etc. 

This is what I'm doing now. I have a media content type that looks like this:

using System;
using System.ComponentModel.DataAnnotations;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DataAnnotations;
using EPiServer.Framework.DataAnnotations;

namespace XXX.XXXXXX.Models.Media
{
[ContentType(DisplayName = "GenericMedia", GUID = "xxxxxxxx-bf22-4cee-93c7-xxxxxxxxx", Description = "Used for generic file types such as Word or PDF documents.")]
[MediaDescriptor(ExtensionString = "pdf,doc,docx")]
public class GenericPdfMedia : MediaData
{
[CultureSpecific]
[Editable(true)]
[Display(
Name = "Title",
Description = "Add a title of the content.",
GroupName = SystemTabNames.Content,
Order = 10)]
public virtual String Title { get; set; }

[CultureSpecific]
[Editable(true)]
[Display(
Name = "Description",
Description = "Add a description of the content.",
GroupName = SystemTabNames.Content,
Order = 20)]
public virtual String Description { get; set; }

}
}
And then I have a content type that uses it like this:
[CultureSpecific]
[Editable(true)]
[Display(
Name = "Images / Attachments",
Description = "Add a media asset for the content.",
GroupName = SystemTabNames.Content,
Order = 400)]
public virtual ContentReference PdfMedia { get; set; }
What do I need to do to let admins add potentially one PDF after another? I don't even know where to begin.

Viewing all articles
Browse latest Browse all 8020

Trending Articles