grav-plugin-simplesearch icon indicating copy to clipboard operation
grav-plugin-simplesearch copied to clipboard

children in modular subpage

Open masetto opened this issue 9 years ago • 6 comments

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; }

masetto avatar Oct 16 '16 18:10 masetto

How about a pull request with this proposed change so we can test it? Thanks!

rhukster avatar Oct 16 '16 20:10 rhukster

Sorry, I do not know how to do, I prefer to attach it here.

simplesearch.zip

masetto avatar Oct 17 '16 07:10 masetto

It's super easy, simply browse to the source file in GitHub and click edit.. This will automatically fork the project and create a pull request. Or read the docs: https://help.github.com/articles/creating-a-pull-request/

rhukster avatar Oct 17 '16 12:10 rhukster

I tried to do it, but I'm not sure if I have created a pull request (see https://github.com/masetto/grav-plugin-simplesearch).

masetto avatar Oct 20 '16 13:10 masetto

You created a PR for your own repository https://github.com/masetto/grav-plugin-simplesearch/pulls, not for this repo.

Check https://help.github.com/articles/creating-a-pull-request-from-a-fork/ on how to submit the PR

flaviocopes avatar Oct 20 '16 13:10 flaviocopes

Finally, I did it! Right?

masetto avatar Oct 20 '16 14:10 masetto