XF 2.0 Having trouble using a callback

Matt C.

Well-known member
I'm trying to use a callback in a template, and I'm having trouble passing the parameters.

Here is my callback:
Code:
<xf:callback class="AH\DevTracker\Repository\Entry" method="getRelative" params="[{$entry.timestamp}]"></xf:callback>


And here is my method:
Code:
public static function getRelative($params)
{
    $m = new \AH\DevTracker\Vendor\Moment\Moment($params);
    $time = $m->fromNow()->getRelative();

    return $time;
}

I know the actual method works fine, because when I put in a UNIX timestamp, it returned the correct value, but for some reason {$entry.timestamp} isn't being passed to the method.

Also, yes, {$entry} is available to use in the template.

Any help would be appreciated, thank you.
 
Last edited:
Top Bottom