Skip to content

Commit

Permalink
search the content of modular pages (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
irauschek authored and rhukster committed Nov 26, 2019
1 parent d921f80 commit 33f03eb
Showing 1 changed file with 15 additions and 2 deletions.
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

0 comments on commit 33f03eb

Please sign in to comment.