For the ColdBox Tip of the Week I reminded everyone of the large number of interception points the framework provides you to listen to. Since ContentBox runs on ColdBox, you obviously have access to all of those as well as a host of additional ContentBox-specific interception points. These are the premier method of tapping into the internals of ContentBox and attaching your own logic to enhance or modify the core.
We have been holding back on documenting ContentBox since so much of it is still in flux, but you can easily find the custom interception points if you simply open up the ModuleConfig.cfc for each of the core modules and look at the customInterceptionPoints declaration. A quick code search can show you examples of where they’re called as well as what is passed in to each one.
Here’s a few to get you started:
- cb_onCustomHTMLRendering
- cbui_afterBodyStart
- cbui_beforeBodyEnd
- cbui_footer
- cbui_onEntryNotFound
- cbui_onContentSearch
- cbui_preCommentPost
- cbui_onInvalidMedia
- cbadmin_postAuthorSave
- cbadmin_postCommentSave
- cbadmin_onLayoutActivation
- cbadmin_preContentVersionRollback
- cbadmin_loginFooter
This is just scratching the surface. Check out the module configs and read the comments to familiarize yourself with them and then keep them in mind next time you think, “Hey, I wish I could make ContentBox do this…”
P.S. Layouts can also declare custom interception points. Check out the default layout in contentbox/layouts/default/default.cfc where you’ll see cbui_beforeBottomBar and cbui_afterBottomBar.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com