Add a dependency flag for an Interceptor, to ensure an order or processing
Sometimes the order of inceptors firing matters, and although we could manually register them all, sometimes that's not practical... perfect example, CONTENTBOX has a lot of interceptors, having to manually register them, would be tough.
My idea, I would like my preProcess interceptor to fire, but I'd like ContentBox's CBHelper interceptor to fire first, so we have all the admin menus, and the oCurrentAuthor done first.
So in my interceptor, i want to be able to say it depends on that interceptor or interceptors.
We should be able to use the interceptor class name.
Our thoughts was to introduce a dependencies property like in modules:
The dependencies would look for the name and must be an exact match. This would mean for interceptors registered without a name, the full path would need to be used. Without this we run the risk of loading the wrong dependency.
When an interceptor has dependencies, each one would be checked to see if it had been fired already. If not, it would be fired immediately (just like with modules).
If a dependency isn’t found, an exception should be thrown.
Here’s some things we’d need to handle:
Tracking which interceptors have fired during each announcement.
Some sort of tracking of circular dependencies to break out and throw an error.
A plan for how this would work for async announcements and async interceptors.