Browse Source
Merge pull request #17438 from abpframework/salihozkara/fixLayout
Fix layout hooks filtering and show layout hooks for the specified layouts
pull/17439/head
Engincan VESKE
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
3 additions and
5 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Components/LayoutHooks/LayoutHook.razor.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/ViewComponentHelperLayoutHookExtensions.cs
|
|
|
@ -25,8 +25,7 @@ public partial class LayoutHook : ComponentBase |
|
|
|
if (LayoutHookOptions.Value.Hooks.TryGetValue(Name, out var layoutHooks)) |
|
|
|
{ |
|
|
|
layoutHooks = layoutHooks |
|
|
|
.Where(IsComponentBase) |
|
|
|
.WhereIf(!string.IsNullOrWhiteSpace(Layout), x => x.Layout == Layout) |
|
|
|
.Where(x => IsComponentBase(x) && (string.IsNullOrWhiteSpace(x.Layout) || x.Layout == Layout)) |
|
|
|
.ToList(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -19,8 +19,7 @@ public class LayoutHookViewComponent : AbpViewComponent |
|
|
|
public virtual IViewComponentResult Invoke(string name, string? layout) |
|
|
|
{ |
|
|
|
var hooks = Options.Hooks.GetOrDefault(name)? |
|
|
|
.Where(IsViewComponent) |
|
|
|
.WhereIf(!string.IsNullOrWhiteSpace(layout), x => x.Layout == layout) |
|
|
|
.Where(x => IsViewComponent(x) && (string.IsNullOrWhiteSpace(x.Layout) || x.Layout == layout)) |
|
|
|
.ToArray() ?? Array.Empty<LayoutHookInfo>(); |
|
|
|
|
|
|
|
return View( |
|
|
|
|
|
|
|
@ -9,7 +9,7 @@ public static class ViewComponentHelperLayoutHookExtensions |
|
|
|
public static Task<IHtmlContent> InvokeLayoutHookAsync( |
|
|
|
this IViewComponentHelper componentHelper, |
|
|
|
string name, |
|
|
|
string? layout = null) |
|
|
|
string layout) |
|
|
|
{ |
|
|
|
return componentHelper.InvokeAsync( |
|
|
|
typeof(LayoutHookViewComponent), |
|
|
|
|