The Unbound Droplist appear to the author as a Droplist field, but its values are not bound to the Sitecore content tree. It uses pipe-delimited string values as its source.
In Sitecore I often see a content pattern I call the Hollow List. It's when items without fields are created to provide the content author with choices. However, if these lists of items do not change this becomes an anti-pattern.
For example, an author can choose if text will be overlayed on the left or right side of a banner. Or items are grouped into categories, say Canadian or American.
These items are not truly content. They're enumerables the author chooses from and developers run conditional code against. If the list doesn't change and they're not authorable content, why are they in our tree?
Introducing The Unbound Droplist
Instead of storing immutable, one-off repositories in your tree use the Unbound Droplilst field and with a piped-value source.
Retrieve its value using ValueLookupField as though it were a normal Droplist.
Download and install the 2013-06-03-UnboundDroplist.zip package from Github. It will do all the work for you. It contains:
- Unbound Droplist field item, added to Core database.
- Config file to register the new field
- Fishtank.SharedSource.CustomFields.dll for Sitecore's bin folder.
Download the source from Github and modify it as needed. While it contains fairly detailed READMEs, I would reiterate the following:
- Install "Core" package found .\src\Package\2013-06-03-Unbound-Droplist-Core.zip
- Copy .\src\App_Config\Include\Fishtank.ControlSources.config into your projects \App_Config\Include\ folder.
- When you build the project, confirm that it's set to "Copy To Local." The DLL must be copied to your Sitecore installations bin.
The Unbound Droplist fills a niche in Sitecore authoring. If the author is choosing a value from a list (i.e. How should this be positioned? [left/right]) but those values aren't likely to change, you can simplify things with the Unbound Droplist.
For coders, ask yourself "Did I just add an Enum to my Sitecore item?" You'll know what to do next. :)
Thanks for reading!