From 777abd048a94dc553d605f3f338ee97810d24996 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 18 Aug 2023 09:55:08 +0800 Subject: [PATCH] Get hooks by current layout. Fix #17394 --- .../Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs index 553c7908c4..082ca59ee0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/LayoutHookViewComponent.cs @@ -18,9 +18,9 @@ public class LayoutHookViewComponent : AbpViewComponent public virtual IViewComponentResult Invoke(string name, string layout) { - var hooks = Options.Hooks.GetOrDefault(name)?.Where(IsViewComponent).ToArray() - ?? Array.Empty(); - + var hooks = Options.Hooks.GetOrDefault(name)?.Where(x => x.Layout == layout && IsViewComponent(x)).ToArray() + ?? Array.Empty(); + return View( "~/Volo/Abp/AspNetCore/Mvc/UI/Components/LayoutHook/Default.cshtml", new LayoutHookViewModel(hooks, layout)