Custom Hooks
Custom hooks provide CMS developers with the ability to extend the functionality of a core set of Ingeniux functions. They can streamline content creation or ensure that content contributors don't forget to perform steps. For example, a custom hook can create page-specific default values when the page is created, thereby reducing the data entry required by content contributors.
Customized functions fire when a selected event occurs in the CMS environment. The functions are hooked to the event. For example, a function called by onBeforeCheckOut would occur before the CheckOut event.
Most events have a before trigger and an after trigger. These triggers are in memory on the object that the action affects, and the action isn't saved until all code in the hook successfully completes. Any action can be interrupted by an error thrown in the hook. If a hook has a script that starts a new action, that action is subordinate to the main action. If an error occurs, all "downstream" actions cease until the error resolves. For instance, if you use the onNew hook to trigger a check-in for a page, but the script in the onBeforeCheckIn hook throws an error, the check-in fails and the new item isn't created.
CustomHooks.cs
Custom hooks are stored in the CustomHooks.cs file. Function skeletons are included in this file and can be fleshed out with scripts that reflect the preferred business logic. This file can be opened as part of the API_Extensions_Development_Harness project to enable IntelliSense, but the CMS independently runs the file. The CustomHooks.cs file resides in [Drive:]\[path-to-cms-site-instance]\App_Data\xml\Custom.
This section includes: