// no MapAll - take care private void Map(IMediaType source, MediaTypeDisplay target, MapperContext context) { MapTypeToDisplayBase <MediaTypeDisplay, PropertyTypeDisplay>(source, target); //default listview target.ListViewEditorName = Constants.Conventions.DataTypes.ListViewPrefix + "Media"; target.IsSystemMediaType = source.IsSystemMediaType(); if (string.IsNullOrEmpty(source.Name)) { return; } var name = Constants.Conventions.DataTypes.ListViewPrefix + source.Name; if (_dataTypeService.GetDataType(name) != null) { target.ListViewEditorName = name; } }
protected override ActionResult <MenuItemCollection> GetMenuForNode(string id, FormCollection queryStrings) { MenuItemCollection menu = _menuItemCollectionFactory.Create(); if (id == Constants.System.RootString) { // set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; // root actions menu.Items.Add <ActionNew>(LocalizedTextService, opensDialog: true, useLegacyIcon: false); menu.Items.Add(new RefreshNode(LocalizedTextService)); return(menu); } IEntitySlim?container = _entityService.Get(int.Parse(id, CultureInfo.InvariantCulture), UmbracoObjectTypes.MediaTypeContainer); if (container != null) { // set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; menu.Items.Add <ActionNew>(LocalizedTextService, opensDialog: true, useLegacyIcon: false); menu.Items.Add(new MenuItem("rename", LocalizedTextService.Localize("actions", "rename")) { Icon = "icon-edit", UseLegacyIcon = false, }); if (container.HasChildren == false) { // can delete doc type menu.Items.Add <ActionDelete>(LocalizedTextService, opensDialog: true, useLegacyIcon: false); } menu.Items.Add(new RefreshNode(LocalizedTextService, separatorBefore: true)); } else { IMediaType?ct = _mediaTypeService.Get(int.Parse(id, CultureInfo.InvariantCulture)); IMediaType?parent = ct == null ? null : _mediaTypeService.Get(ct.ParentId); menu.Items.Add <ActionNew>(LocalizedTextService, opensDialog: true, useLegacyIcon: false); // no move action if this is a child doc type if (parent == null) { menu.Items.Add <ActionMove>(LocalizedTextService, hasSeparator: true, opensDialog: true, useLegacyIcon: false); } menu.Items.Add <ActionCopy>(LocalizedTextService, opensDialog: true, useLegacyIcon: false); if (ct?.IsSystemMediaType() == false) { menu.Items.Add <ActionDelete>(LocalizedTextService, opensDialog: true, useLegacyIcon: false); } menu.Items.Add(new RefreshNode(LocalizedTextService, separatorBefore: true)); } return(menu); }