Making Function Arguments Return Asset Info

I understand that if I create a paint and process function within my edit_interface_screen_details.xml file, I can then use arguments for that function to gather asset information, e.g:

    function myFunction(My_Asset $asset)
    {
    	 echo $asset->id;
    }


This would return the ID of the current asset. This does work perfectly, if I define that function within my XML file as a process function.

BUT, what if I don't want to define new functions for a field, but still return asset information from the args of a function?

So, say I wanted to create a new function in my asset_edit_fns.inc file:

    function myNewFunction(My_Asset $asset)
    {
    	 echo $asset->id;
    }


Since this function is not defined in the XML file, I get a php error telling me that the argument passed must be an instance of my asset type and none was given.
How can I do this?

Thanks, and if I have not been clear, please let me know. :)

How are you calling this function? Do you have access to the asset object where you call it from? Can you pass that in?


Thanks Greg for helping me clear my brain.

Not sure what I was thinking, but your suggestion was perfect.

For some reason I was not thinking about passing the asset object to my function from the function that I was calling it in. :)

So, now in my process function I am calling my function:

    $this->myNewFunction($asset);


And it is correctly passing the asset object.

Ha, I am slightly embarrassed for not even realizing that!

Thanks.