What he means is that the link() function is called from the renderer when you set linkto=True, and thus it should not be called separately from represent_row. 

Instead, you should implement a link function which takes (layer_id, represent, row=None) as input and returns a link - it would basically do the same as the "if showlink" branch.

Can't help you so much more than that - otherwise there's no point in having you just retype what I type.