Is there a Kirby variant of var_dump or print_r for collections?
Whenever I use the native PHP functions it outputs what seems to be the whole Kirby index and not the data I’m expecting.
<?php print_r( $page->images() ); ?>
Doesn’t print just an object of images objects. Like I said it prints a whole bunch of stuff not directly related to the current collection.
If you are only interested in what images are contained in the collection, you can use the following:
<?php print_r($page->images()->keys()); ?>
This also works for page collections:
<?php print_r($page->children()->keys()); ?>
Completely missed that in the docs! Thanks!
Worth mentioning here, there’s also
collection::toJson(), which can help make the dump more readable.