Link to mediatype from media properties

This commit is contained in:
Thomas Nielsen
2016-11-02 21:20:03 +01:00
parent ef38808ba5
commit ea67e21796

View File

@@ -155,7 +155,27 @@ namespace Umbraco.Web.Models.Mapping
genericProperties.Add(link);
}
TabsAndPropertiesResolver.MapGenericProperties(media, display, localizedText, genericProperties);
TabsAndPropertiesResolver.MapGenericProperties(media, display, localizedText, genericProperties, properties => {
if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null
&& UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings)))
{
var docTypeLink = string.Format("#/settings/mediatypes/edit/{0}", media.ContentTypeId);
//Replace the doc type property
var docTypeProp = properties.First(x => x.Alias == string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix));
docTypeProp.Value = new List<object>
{
new
{
linkText = media.ContentType.Name,
url = docTypeLink,
target = "_self", icon = "icon-item-arrangement"
}
};
docTypeProp.View = "urllist";
}
});
}
}