This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Umbraco.Cms.Core.Composing; | |
using Umbraco.Cms.Core.Routing; | |
namespace Umbraco.Cms.Web.UI.Composers; | |
public class SoftwarePageUrlsComposer : IComposer | |
{ | |
public void Compose(IUmbracoBuilder builder) | |
{ | |
builder.UrlProviders().Insert<SoftwarePageUrlProvider>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyProject.Web.Customization; | |
public static class SoftwarePageUrlHelper | |
{ | |
public static bool IsSoftwarePage(string contentTypeAlias, string? contentName) => | |
contentTypeAlias == "testPage" && | |
!string.IsNullOrEmpty(contentName) && | |
contentName.EndsWith(" Software"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Umbraco.Cms.Core.Models; | |
using Umbraco.Cms.Core.Strings; | |
namespace MyProject.Web.Customization; | |
public class SoftwarePageUrlSegmentProvider : IUrlSegmentProvider | |
{ | |
private readonly IUrlSegmentProvider _provider; | |
public SoftwarePageUrlSegmentProvider(IShortStringHelper stringHelper) => _provider = new DefaultUrlSegmentProvider(stringHelper); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Umbraco.Cms.Core.Models.PublishedContent; | |
using Umbraco.Cms.Core.Routing; | |
using Umbraco.Cms.Core.Services; | |
using Umbraco.Cms.Core.Web; | |
namespace MyProject.Web.Customization; | |
public class SoftwarePageContentFinder : IContentFinder | |
{ | |
private readonly IDocumentUrlService _documentUrlService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Options; | |
using Umbraco.Cms.Core.Configuration.Models; | |
using Umbraco.Cms.Core.Models.PublishedContent; | |
using Umbraco.Cms.Core.PublishedCache; | |
using Umbraco.Cms.Core.Routing; | |
using Umbraco.Cms.Core.Services; | |
using Umbraco.Cms.Core.Services.Navigation; | |
using Umbraco.Cms.Core.Strings; | |
using Umbraco.Cms.Core.Web; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var commands = new List<ImageUrlGenerationOptions>(); | |
imageUrlGeneratorMock.Verify(x => x.GetImageUrl(Capture.In(commands, cmd => true))); | |
foreach (ImageUrlGenerationOptions command in commands) | |
{ | |
System.Diagnostics.Debug.WriteLine(command.Height); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageUrlGeneratorMock | |
.Setup(x => x.GetImageUrl(It.IsAny<ImageUrlGenerationOptions>())) | |
.Returns("/test.png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageUrlGeneratorMock | |
.Setup(x => x.GetImageUrl(It.Is<ImageUrlGenerationOptions>(y => y.Height == Height))) | |
.Returns("/test.png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiExplorerSettings(GroupName = "forms")] |
NewerOlder