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

Allow to find descendents at a certain depth. #23

Closed
simesy opened this issue Feb 20, 2021 · 1 comment · Fixed by #24
Closed

Allow to find descendents at a certain depth. #23

simesy opened this issue Feb 20, 2021 · 1 comment · Fixed by #24

Comments

@simesy
Copy link
Contributor

simesy commented Feb 20, 2021

Currently findDescendents() searches down to a bottom depth, and I'd also like to be able to pass a top depth.

This is not critical functionality for me, but I think it would be a nice feature. I'm about to do a patch on the drupal module that would use this feature if it was available.

My proposal i don't think would break any existing functionality. But I could also create a new method findDescendentsAtDepth

  public function findDescendants(NodeKey $nodeKey, $depth = 0) {

becomes

  public function findDescendants(NodeKey $nodeKey, $end_depth = 0, $start_depth = 0) {
@simesy
Copy link
Contributor Author

simesy commented Feb 20, 2021

The order of arguments is a bit weird, but you're much more likely to set end depth, so it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant