Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Linq;
- using EPiServer.Shell.ObjectEditing;
- namespace Project.Business.Selection
- {
- public class ResourceIconSelection : ISelectionFactory
- {
- public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
- {
- var iconsList = new SortedDictionary<string, string>();
- iconsList.Add("Link", "link");
- iconsList.Add("Media", "media");
- iconsList.Add("PDF", "pdf");
- return iconsList
- .Select(x => new SelectItem() { Text = x.Key, Value = x.Value })
- .ToArray();
- }
- }
- }
- ////Next declare property in your model. For select use 'SelectOne' and for list of checkboxes use 'SelectMany'.
- [SelectOne(SelectionFactoryType = typeof(ResourceIconSelection))]
- [Display(
- Name = "Icon",
- GroupName = SystemTabNames.Content,
- Order = 10)]
- public virtual string Icon { get; set; }
Add Comment
Please, Sign In to add comment