* Run code cleanup * Start manual run * Finish dotnet format + manual cleanup * Fix up after merge * Fix substrings changed to [..] Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk> Co-authored-by: Zeegaan <nge@umbraco.dk>
22 lines
693 B
C#
22 lines
693 B
C#
using Microsoft.AspNetCore.Routing;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Web.BackOffice.Trees;
|
|
using Umbraco.Cms.Web.Common.Controllers;
|
|
using Umbraco.Extensions;
|
|
|
|
namespace Umbraco.Cms.Web.BackOffice.Mapping;
|
|
|
|
public class CommonTreeNodeMapper
|
|
{
|
|
private readonly LinkGenerator _linkGenerator;
|
|
|
|
|
|
public CommonTreeNodeMapper(LinkGenerator linkGenerator) => _linkGenerator = linkGenerator;
|
|
|
|
|
|
public string? GetTreeNodeUrl<TController>(IContentBase source)
|
|
where TController : UmbracoApiController, ITreeNodeController =>
|
|
_linkGenerator.GetUmbracoApiService<TController>(controller =>
|
|
controller.GetTreeNode(source.Key.ToString("N"), null));
|
|
}
|