Why can I not extend some classes?

Marcus

Well-known member
Some classes like XenForo_Link or XenForo_BbCode_TextWrapper can not be extended. Is there a reason behind this like security or performance (the new hint system might help)?
 
They're just used statically. Since there's no instantiation, you can't extend them.
 
why would you want to extend XenForo_Link?
I want to extend XenForo_Link::buildPublicLink for my Virtual Forums. When a user is browsing a virtual forum with node_id=5, he is actually viewing node_id=3 and all links on the page include a &real_node_id=3. How could I change the pagination links who are created with XenForo_Link::buildPublicLink?

Christian Discussion
- Abraham Forum (node_id = 5, its just a virtual forum with link to real_node_id = 3)
- Jesus Forum
Jewish Discussion
- Abraham Forum (node_id = 3)
 
It certainly would be nice if any/all classes could be extended, but some things it's just not practical to be able to extend on the fly. Personally, I still have to hack on 5 files (not a major task) on an upgrade.

These are the ones that I still have to edit the PHP files on...

library/XenForo/Model/Avatar.php
library/XenForo/ViewPublic/Helper/User.php
library/XenForo/ControllerPublic/Abstract.php
library/XenForo/Helper/String.php
library/XenForo/CodeEvent.php
 
Is it possible to extend XenForo_Template_Helper_Core?
I know I had some problems doing that one or two years ago, but then I didn't know so much about xenforo either. Some functions could not be extended, not sure if it was a problem with the whole class.
 
Back
Top Bottom