Skip to content
Merged
13 changes: 13 additions & 0 deletions app/Models/Common/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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を返す
*/
Expand Down
8 changes: 8 additions & 0 deletions app/Plugins/User/Searchs/SearchsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading