Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search the content of modular pages #170

Merged
merged 1 commit into from
Nov 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions simplesearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,21 @@ public function onPagesInitialized()
}
}

//Drop unpublished and unroutable pages
$this->collection->published()->routable();
//Drop unpublished pages, but do not drop unroutable pages right now to be able to search modular pages which are unroutable per se
$this->collection->published();
/** @var modular Pages $modularPageCollection */
$modularPageCollection = $this->collection->copy();
//Get published modular pages
$modularPageCollection->modular();
foreach ($modularPageCollection as $cpage) {
if (!$cpage->parent()->published()) {
$modularPageCollection->remove($cpage);
}
}
//Drop unroutable pages
$this->collection->routable();
//Add modular pages again
$this->collection->merge($modularPageCollection);

//Check if user has permission to view page
if ($this->grav['config']->get('plugins.login.enabled')) {
Expand Down