Forum
Item callback function (using 'each')
Hi,
could I double-check something with you?
Quoting the docs, in relation to using
'each' => function($item) {...
"After processing, the function must return the array."
I've been playing with this and returning nothing from the function works absolutely fine - is this by design? If so, I can use 'each' to provide some extra-fine filtering, so some items are returned, others aren't. Just thought I'd check with you before committing with my code - I don't want it to break in a future version... ;-)
This is using 2.8.31.
The idea is you get handed
$item
, you manipulate it, and then you return it.If you don't return
$item
then that item won't be included in the result.Thanks Drew - I know that's the idea, it's just that in a current case, I can use this to provide 'extra' filtering by not returning $item.
Cheers.
Right, as I said, that's how it works.