23478 Posts in 18950 Topics by 2878 members
|Go to End|
20 February 2014 at 4:00am
I'm currently developing an extension that can be used by page types and other extensions.
I'm running code in the onAfterInit() method of my extension, and I want to allow other extensions to run code before that.
However Extension isn't extending Object, so I cannot create my own extension points.
I can't ensure that my code is run after all other onAfterInit() code (what if another module also wants to run last), so do I have any options?
22 February 2014 at 9:06pm
AFAIK, no you don't have any control over making sure your extension is 'last' in the Extension API.
In an application you could add the extension before your extension and then in theory your extension would run last. By using the config system you could specify that your config comes after any other config so might run last?
23 February 2014 at 2:37am
FYI After further experimentation, the most robust solution I've found was to simply use the config.yml API.
Initially, I was using After: "*" however my onAfterInit method was then loaded before everything else (testing through Debug statements). Therefore the result I settled on is to define Before: "mysite" because it seems onAfterInit is not applied in the correct logical order.
|Go to Top|