Enhanced PropertyList for Episerver

One of my most perennially popular blog posts is the one where I looked at showing friendly URLs for ContentReferences and (internal) Urls in a PropertyList. Even though new blog posts normally get inundated with hits (ok, that's laying it on a bit strong!) it still makes up a good chunk of traffic:

Most popular blog post pie chart

Given that it's a popular topic and the code has been copied-and-pasted into numerous solutions I thought I'd do what I probably should have done before and create a NuGet package. That way, if someone finds a bug or makes an improvement, they can submit a PR and we'll all benefit.

Before I waffle on with some more details, it's called the Enhanced PropertyList and you can find the NuGet package in the Episerver NuGet Feed (use version 1.0.1, version 1.0.0 has a bug but I'm unable to delist it due to a bug!), more details are available in the GitHub repository readme.

Overall, I made three obvious changes:

  1. I switched to showing content names when applicable, which is more in line with how Episerver shows links in edit mode.
  2. I added previews for images (virtually the same as the way Grzegorz did in his blog post).
  3. I really simplified usage.

On the last point: I was never really satisified with having to use an attribute to specifically identify the properties. I switched it to using reflection (and identifying images by the UIHint) which means using it is as simple as using the EnhancedCollectionEditorDescriptor where you'd normally use the default CollectionEditorDescriptor:

[EditorDescriptor(EditorDescriptorType = typeof(EnhancedCollectionEditorDescriptor<Item>))]
public virtual IList<Item> Items { get; set; }

Finally, here is how a PropertyList with URLs, ContentReferences and images looks using the Enhanced PropertyList (hovering will allow you to compare with how it looked before):

Enhanced Episerver PropertyList Standard Episerver PropertyList

Let me know if you have any suggestions or improvements!

Comments

Nice, PropertyLists are still one of the most buggy properties with the base types since release. Epi should have really sorted it by now to at least work with the core epi types. Usually implement fixes myself but like the package.

Scott Reed