Guest User

Untitled

a guest
Nov 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using EPiServer.Shell.ObjectEditing;
  4.  
  5. namespace Project.Business.Selection
  6. {
  7. public class ResourceIconSelection : ISelectionFactory
  8. {
  9. public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
  10. {
  11. var iconsList = new SortedDictionary<string, string>();
  12.  
  13. iconsList.Add("Link", "link");
  14. iconsList.Add("Media", "media");
  15. iconsList.Add("PDF", "pdf");
  16.  
  17. return iconsList
  18. .Select(x => new SelectItem() { Text = x.Key, Value = x.Value })
  19. .ToArray();
  20. }
  21. }
  22. }
  23.  
  24. ////Next declare property in your model. For select use 'SelectOne' and for list of checkboxes use 'SelectMany'.
  25.  
  26. [SelectOne(SelectionFactoryType = typeof(ResourceIconSelection))]
  27. [Display(
  28. Name = "Icon",
  29. GroupName = SystemTabNames.Content,
  30. Order = 10)]
  31. public virtual string Icon { get; set; }
Add Comment
Please, Sign In to add comment