Add-On Collisions

digitalpoint

Well-known member
So I started digging around the event listener system for hooking into existing classes, and I really like it so far since it's pretty generic and allows you to hook into most anything.

But it got me thinking... what happens if a site has two different add-ons that are both extending the same method?
 
That depends upon whether the addons are calling the parent methods or not. If they are, both of the addons will work. Because of the way proxy classes are evaluated at runtime, parent:: for the second addon would be the overriding method of your first addon.

Sample Class Hierarchy...
Rich (BB code):
XenForo_ControllerPublic_Index
            ↑
XFCP_Addon1_ControllerPublic_Index (Proxy Class)
            ↑
Addon1_ControllerPublic_Index
            ↑
XFCP_Addon2_ControllerPublic_Index (Proxy Class)
            ↑
Addon2_ControllerPublic_Index
 
I hadn't time to check how it's working exactly, but it's working.

I have 4 add-ons extending the _postSave method in the user datawriter, and all are working now ( i've forgotten to call the parent postSavein the past) nice. (that means, after a user registration, add-on 1 creates a welcome thread, add-on2 starts a conversation, add-on3 sends a mail to the admin, add-on4 is making some hidden stuff^^
 
I'm bumping this because I had a quick question on something. The "Callback Execution Order," if I set that to something really, really, extremely high (say 100000), I can nearly ensure that when XF creates the proxy classes, my class will be defined last. Correct? Question being is I'm thinking about setting it up so that I can do so with BBCM to allow for more modifications to inject their own BBCodes and have mine inherit them. ;)
 
Top Bottom