Add item count int collection tree

Hi,

I'm trying to add a number of items for each collection in collection tree plugin.

I identify file: CollectionTreeFullList.php line 33, but I don't know how to do it.
I saw a lot of way to do it, but can't do it:

http://omeka.org/forums/topic/collection-tree-item-count-and-description

set_current_collection($collection); is giving me the error:
Fatal error: Call to undefined function set_current_collection()

metadata('collection', 'total items'); tell me:

A current collection variable has not been set to this view.

How can I do?

The beginning of that thread refers to a much older version of Omeka. The solution at the end of the thread, though, looks like it should work.

$thiscollection = get_record_by_id('Collection', $rootCollection['id']);

gives me:

{"public":1,"featured":0,"added":"2015-08-22 08:29:07","modified":"2015-09-06 03:40:10","owner_id":1,"id":5}

And

metadata($thiscollection, 'total_items')

always gives me 0 :(

could you post exactly what you have in collectionTreeList? the code seems to be working as expected for me.

I got it, I was editing CollectionTreeFullList.php

Now I got it working for collectionTreeList.

Is there anyway to apply it to CollectionTreeFullList.php?

Tx

It looks like the same changes should work in both places.