From 5cf4b17abe416a05eb47b1bc9f3f6ab5ea2856ba Mon Sep 17 00:00:00 2001 From: giannik Date: Thu, 20 Jun 2024 22:41:31 +0300 Subject: [PATCH] optional route param for content-item display --- .../OrchardCore.Contents/Controllers/ItemController.cs | 4 ++-- src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ItemController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ItemController.cs index 66f5aaeb5c5..dd799a76145 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ItemController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ItemController.cs @@ -23,7 +23,7 @@ public ItemController( _authorizationService = authorizationService; } - public async Task Display(string contentItemId, string jsonPath) + public async Task Display(string contentItemId, string jsonPath, string displayType) { var contentItem = await _contentManager.GetAsync(contentItemId, jsonPath); @@ -37,7 +37,7 @@ public async Task Display(string contentItemId, string jsonPath) return this.ChallengeOrForbid(); } - var model = await _contentItemDisplayManager.BuildDisplayAsync(contentItem, this); + var model = await _contentItemDisplayManager.BuildDisplayAsync(contentItem, this, displayType); return View(model); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs index 2870c72a596..6b8473d48b7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs @@ -222,7 +222,7 @@ public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilde routes.MapAreaControllerRoute( name: "DisplayContentItem", areaName: "OrchardCore.Contents", - pattern: "Contents/ContentItems/{contentItemId}", + pattern: "Contents/ContentItems/{contentItemId}/{displayType?}", defaults: new { controller = itemControllerName, action = nameof(ItemController.Display) } );