Files
Umbraco-CMS/src/Umbraco.Web/PropertyEditors/NestedContentController.cs
T
leekelleher 83588b2dc8 ContentTypeService GetAllElementTypes method
Added an extension method to get all the Element Types from
the ContentTypeService.

Refactored NestedContent's controller accordingly.
2019-09-05 15:36:14 +02:00

30 lines
866 B
C#

using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Services;
using Umbraco.Web.Editors;
using Umbraco.Web.Mvc;
namespace Umbraco.Web.PropertyEditors
{
[PluginController("UmbracoApi")]
public class NestedContentController : UmbracoAuthorizedJsonController
{
[System.Web.Http.HttpGet]
public IEnumerable<object> GetContentTypes()
{
return Services.ContentTypeService
.GetAllElementTypes()
.OrderBy(x => x.SortOrder)
.Select(x => new
{
id = x.Id,
guid = x.Key,
name = x.Name,
alias = x.Alias,
icon = x.Icon,
tabs = x.CompositionPropertyGroups.Select(y => y.Name).Distinct()
});
}
}
}