Andy, here's some more detail...
The magic sauce for link-building resides in the Route_Prefix class for any given route.
As Jeremy pointed out, for threads, that class is XenForo_Route_Prefix_Threads.
Look in library/XenForo/Route/Prefix/Threads.php and you'll find a function buildLink.
The most important line is the final one:
Code:
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'thread_id', 'title') . $postHash;
Notice the 'thread_id' and 'title' names. Whatever array you pass will need those two keys to create an appropriate link.
Most commonly, if you have an entire thread loaded into $thread already, you could get the link this way:
Code:
XenForo_Link::buildPublicLink('threads', $thread)
If you don't already have an array loaded with those fields, you could do this:
Code:
XenForo_Link::buildPublicLink('threads',array('thread_id' => $threadId, 'title' => $title));
Either way, you'll get back a link that looks like mysite.com/threads/thread-title.thread-id/
I mainly go into all this because you'll probably want to add a buildLink into your Route_Prefix_ShowDelete class as well.
The version in most of my route prefixes is a simple one-liner like this:
Code:
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'tourn_id', 'event_name');
}
In that example, I use a tournament Id and the event's name to build a pretty link into my 'tournaments' route.
The key is that if you want to add a single ID type parameter into your route's URLs, this tells it which field that represents,
and additionally, which field can be used to build the SEO-friendly version that includes more than just the numeric ID.
Make sense?