|
3 | 3 | using Umbraco.Cms.Core.DependencyInjection; |
4 | 4 | using Umbraco.Cms.Core.Models.PublishedContent; |
5 | 5 | using Umbraco.Cms.Core.PublishedCache; |
| 6 | +using Umbraco.Cms.Core.Routing; |
6 | 7 | using Umbraco.Cms.Core.Services; |
7 | 8 | using Umbraco.Cms.Core.Services.Navigation; |
8 | | -using Umbraco.Cms.Infrastructure.HybridCache.Services; |
9 | 9 | using Umbraco.Extensions; |
10 | 10 |
|
11 | 11 | namespace Umbraco.Cms.Infrastructure.HybridCache; |
@@ -95,30 +95,31 @@ public IEnumerable<IPublishedContent> GetAtRoot(string? culture = null) |
95 | 95 | public IEnumerable<IPublishedContent> GetByContentType(IPublishedContentType contentType) |
96 | 96 | => _documentCacheService.GetByContentType(contentType); |
97 | 97 |
|
98 | | - [Obsolete("Use IDocumentUrlService.GetDocumentKeyByRoute instead, scheduled for removal in v17")] |
| 98 | + [Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")] |
99 | 99 | public IPublishedContent? GetByRoute(bool preview, string route, bool? hideTopLevelNode = null, string? culture = null) |
100 | 100 | { |
101 | 101 | IDocumentUrlService documentUrlService = StaticServiceProvider.Instance.GetRequiredService<IDocumentUrlService>(); |
102 | 102 | Guid? key = documentUrlService.GetDocumentKeyByRoute(route, culture, null, preview); |
103 | 103 | return key is not null ? GetById(preview, key.Value) : null; |
104 | 104 | } |
105 | 105 |
|
106 | | - [Obsolete("Use IDocumentUrlService.GetDocumentKeyByRoute instead, scheduled for removal in v17")] |
| 106 | + [Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")] |
107 | 107 | public IPublishedContent? GetByRoute(string route, bool? hideTopLevelNode = null, string? culture = null) |
108 | 108 | { |
109 | 109 | IDocumentUrlService documentUrlService = StaticServiceProvider.Instance.GetRequiredService<IDocumentUrlService>(); |
110 | 110 | Guid? key = documentUrlService.GetDocumentKeyByRoute(route, culture, null, false); |
111 | 111 | return key is not null ? GetById(key.Value) : null; |
112 | 112 | } |
113 | 113 |
|
114 | | - [Obsolete("Use IDocumentUrlService.GetDocumentKeyByRoute instead, scheduled for removal in v17")] |
| 114 | + [Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")] |
115 | 115 | public string? GetRouteById(bool preview, int contentId, string? culture = null) |
116 | 116 | { |
117 | | - IDocumentUrlService documentUrlService = StaticServiceProvider.Instance.GetRequiredService<IDocumentUrlService>(); |
| 117 | + IPublishedUrlProvider publishedUrlProvider = StaticServiceProvider.Instance.GetRequiredService<IPublishedUrlProvider>(); |
118 | 118 | IPublishedContent? content = GetById(preview, contentId); |
119 | | - return content is not null ? documentUrlService.GetLegacyRouteFormat(content.Key, culture, preview) : null; |
| 119 | + |
| 120 | + return content is not null ? publishedUrlProvider.GetUrl(content, UrlMode.Relative, culture) : null; |
120 | 121 | } |
121 | 122 |
|
122 | | - [Obsolete("Use IDocumentUrlService.GetDocumentKeyByRoute instead, scheduled for removal in v17")] |
| 123 | + [Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")] |
123 | 124 | public string? GetRouteById(int contentId, string? culture = null) => GetRouteById(false, contentId, culture); |
124 | 125 | } |
0 commit comments