diff --git a/app/Models/Common/Page.php b/app/Models/Common/Page.php index 612e3ea95..df752f0d1 100644 --- a/app/Models/Common/Page.php +++ b/app/Models/Common/Page.php @@ -491,6 +491,19 @@ public function isVisibleAncestorsAndSelf(Collection $page_tree) : bool return $is_view; } + /** + * 親子ページを加味して メニュー表示(基本表示フラグ)の判断 + * + * - isVisibleAncestorsAndSelf() は権限判定用で base_display_flag を見ないため、こちらで判定する。 + * - 親がメニュー非表示なら子孫もメニュー非表示(defaultOrderWithDepth() の継承ルールと同じ)。 + */ + public function isVisibleMenuAncestorsAndSelf(Collection $page_tree): bool + { + return $page_tree->every(function ($page_obj) { + return $page_obj->base_display_flag == 1; + }); + } + /** * ページのURLを返す */ diff --git a/app/Plugins/User/Searchs/SearchsPlugin.php b/app/Plugins/User/Searchs/SearchsPlugin.php index a168a3960..4856520d2 100644 --- a/app/Plugins/User/Searchs/SearchsPlugin.php +++ b/app/Plugins/User/Searchs/SearchsPlugin.php @@ -517,6 +517,14 @@ private function fetchSearchablePageIds($request, $searchs_frame) continue; } + // ページの選択「ページ管理のメニュー表示条件に従う」 & フレームの選択「選択したものだけ表示する」以外 + if ($searchs_frame->page_select == SearchsPageSelect::menu_visible_only + && $searchs_frame->frame_select != SearchsFrameSelect::selected_only + && !$page->isVisibleMenuAncestorsAndSelf($page_tree)) { + // メニュー非表示(隠しページ)なので、見れないページ + continue; + } + // 親子ページを加味してページ表示できるか if (!$page->isVisibleAncestorsAndSelf($page_tree)) { continue;