Find next listed page that has a certain checkbox checked

Hi!

I browsed the reference but couldn’t find an answer to my question.
Is there a preset function to get the next listed page that has a certain checkbox checked?

Something like $page->nextListed()->filterBy('category', 'print')->url()?
Of course a single page can’t be filtered but maybe something similar.

The checkbox on page A would be ‘web’ and is listed.
The checkbox on page B would be ‘print’ and is listed.
The checkbox on page C would be ‘web’ and is listed.

I’d like to get the next listed sibling of A with the same category as A.

It’s like a forward only pagination but with categories.

Thanks!

The next/hasNext etc. methods accept a collection as parameter. So you create your filtered collection first, then pass it as a parameter to the method.

Examples in the documentation:

1 Like

Thanks! It works!