XF 2.2 Best way to extend existing templater.php functions?

Gobb

Member
Hi,

As per the title, just wondering the best way this is done. I've done the class extension, but I am looking to extend fnUsernameLink in particular. I've already done this and it works fine, but I am just wondering the most appropriate way this should be done?

Basically, I have a custom username css column in the user database. I am extending this function so that when this data exists, it applies the css to the span element containing the username. This can be done on condition by:
  • String replacing the parent function
  • I assume regex on the parent function
  • Use the original XF code but make manual edits to add this in
  • Return parent or original code with edits
  • Return parent or custom built username link
Is this a case of just pick whichever option as there are multiple ways, or is there a "best" way to do it?

Thanks.
 
Top Bottom