Hey Brad.
I’d like to see “this.handlersParentLookup” in modules, so I can override module handlers in my application, the same way I can for views and layouts.
So, for example, in my parent application I override module handlers to adjust functionality without needing to touch the module itself.
I’ve actually adjusted Coldbox myself to get this working, but I only used the handlersLocation and NOT the handlersExternalLocation – to make sure that any name conflicts didn’t become an issue (such as main.cfc/general.cfc etc.) Obviously I can extend the module handler using this method, so I can create custom events or override existing module events – was is kinda cool.
As I said, I’ve adjusted CB myself already, but I think this would be useful for others perhaps?
I just added this to HandlerService:getRegisteredHandler:
if (moduleSettings[moduleReceived].handlerParentLookup) {
ParentHandlerReceived = “modules.#moduleReceived#.#handlerReceived#”;
handlerIndex = listFindNoCase(handlersList, ParentHandlerReceived);
// Check for conventions location
if ( handlerIndex ){
return HandlerBean
.setHandler(listgetAt(handlersList,handlerIndex))
.setMethod(MethodReceived);
}
// Check for external location
/* don’t actually look in the external location, name conflicts are likely…
handlerIndex = listFindNoCase(handlersExternalList, ParentHandlerReceived);
if( handlerIndex ){
return HandlerBean
.setInvocationPath(instance.handlersExternalLocation)
.setHandler(listgetAt(handlersExternalList,handlerIndex))
.setMethod(MethodReceived);
}
*/
}
Tom.