pipit_get_collection_key_for()

Get the key of the collection an item belongs to (given the item ID):

pipit_get_collection_key_for($itemID);

This is useful when you know the a collection item ID, but you don’t know which collection it belongs to. For example, if you’re outputting items from multiple collections at once:

perch_collection(['Blog', 'News'], [
    'each' => function($item) {
        $item['collectionKey'] = pipit_get_collection_key_for($item['_id']);
        return $item;
    }
]);
link