getgrav / getgrav/grav-plugin-simplesearch

children in modular subpage

Open
#74 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
46
Forks
55
Avg merge
5h 44m
Merged PRs (30d)
1

Description

I have childrens in modular subpage and I suggest this change:

row 173
`$parent = $this->getModularParent($cpage, $cpage);
if ($parent)
$extras[$parent->path()] = ['slug' => $parent->slug()];
`
instead of:
`if ($cpage->modular()) {
$this->collection->remove($cpage);
$parent = $cpage->parent();
$extras[$parent->path()] = ['slug' => $parent->slug()];
}
`

I create this function:
`protected function getModularParent($cpage, $leafPage) {
$parent = null;
if ($cpage->modular()) {
$this->collection->remove($leafPage);
$parent = $cpage->parent();
} elseif ($cpage->parent()) {
$parent = $this->getModularParent($cpage->parent(), $cpage);
}
return $parent;
}
`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.