• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 How to extend a XenForo class that doesn't appear to fire XFCP?

Yugensoft

Active member
#1
I want to know if it's possible to extend the class XenForo_BbCode_TextWrapper, as it doesn't appear to fire the code event listeners.
Thanks
 

Mike

XenForo developer
Staff member
#2
If it doesn't trigger the load_class event, you wouldn't be able to extend the class directly.

This class doesn't do much on its own though. It is mostly passing on to the BB code renderer, though it does potentially interject caching in there. What are you trying to do?
 

Yugensoft

Active member
#3
If it doesn't trigger the load_class event, you wouldn't be able to extend the class directly.

This class doesn't do much on its own though. It is mostly passing on to the BB code renderer, though it does potentially interject caching in there. What are you trying to do?
I need concurrent access to the post id and the full rendering output, e.g. to fully cache it in cases where there is significant content modification being done to it by an addon.

That class has access to post id via $cache. But the XenForo_BbCode_Parser render() doesn't receive that (so no point trying to extend there). So currently I can't see a way to do this without directly editing the class, which of course isn't addon packageable.

Or is there a way to override pathing in XenForo so it uses a class from a different location to usual?
 

Mike

XenForo developer
Staff member
#4
I'm not totally sure what you're trying to cache -- generally, you don't want to cache rendered BB code as it has a lot of variables (permissions, styles, languages, etc).

But there isn't really a way to extend this class, short of some pretty extensive hacks which I couldn't really recommend.