Wrong documentation when filtering for translation?


I am not sure if I should file a documentation bug so I ask first.
Is the example given in $pages->filter($callback) still supposed to work in Kirby 2.3?

//fetch children in the current language only
$items = $page->children()->visible()->filter(function($child) {
  return site()->language()->code() == $child->language()->code();

If not, it could probably be replaced with:

$items = $page->children()->visible()->filter(function($child) {
  return $child->content(site()->language()->code)->exists();


Thanks for your feedback. Does the example not work for you? But yes, it could be replaced with your example.

No, it wasn’t working anymore after the update. But I didn’t build a test case to isolate the problem, so it could be something else.

OK, thanks, but the new code looks cleaner anyway :slight_smile:. I updated the docs.

Be aware that I have been missing parantheses after ->code in my example.

1 Like