Working With Custom Hooks in Ingeniux CMS
Custom hooks have the potential to enhance and streamline daily processes in the CMS and facilitate user productivity. In this series, we take a look at how custom hooks can be used in the Ingeniux platform.
In this series of articles, we’ll explore what custom hooks are and how they can be used in Ingeniux CMS to extend and enhance the functionality of the platform.
An important first step in deciding how to use custom hooks to your best advantage is to identify repeating and predictable steps in the processes that your users go through when entering content. Find ways that you can save them time, and ways that you can help them adhere to policies and procedures your institution might have.
What Is a Custom Hook?
A custom hook is a development method for enhancing and extending certain events in the Ingeniux CMS. Custom hooks are triggered when certain events happen in the CMS, events like the creation or deletion of a content item in the site tree for example. Whenever an event like this happens, whether by the direct action of a user or by system processes, the code that you write in the custom hooks file for that event is processed.
Development of custom hooks greatly enhance the functionality of the CMS and facilitate user productivity.
When a custom hook is fired, you are usually given a few things as parameters to work with, such as the session that took the action and the item that was affected by the action. You can see which parameters you’ll get in the explanation leading up to each new hook in the file.
The best way to edit custom hooks is to open the API Extensions Development Harness Project from your CMS installation directory in the site > App_Data > xml > Custom folder with Visual Studio. Opening the file with Visual Studio gives you IntelliSense, which is a general term for various code editing features including: code completion, parameter info, quick info, and member lists. IntelliSense features are sometimes called by other names such as "code completion", "content assist", and "code hinting."
One important thing to remember about custom hooks is that you don’t get messaging abilities. The only message you can give to a user is when an exception is thrown. Throwing an exception will terminate the process that was attempted by the hook. This is handy in that you can easily stop any process, but you only have the thrown exception to tell the user why you have done so. You also can’t confirm that a process was successfully completed using the CMS messaging. You will most likely want to add some logging to your processes and capture confirmations and exceptions so you can review them periodically and make sure all of your hooks are firing properly. You could even give your users a view into those logs to confirm that the things they attempted were successful.
Types of Custom Hooks
Below we’ll explore various hooks found in Ingeniux CMS, including key considerations and code examples. The examples require you to set up specific scenarios in a CMS to use as-is, or you can adapt them to your needs.
Custom Hooks in Ingeniux CMS:
- OnNew
- OnRename
- OnCheckIn
- OnCheckOut
- OnMarkForPublish
- OnBeforePublish
- OnPublishComplete
- OnDelete
- OnCopy
- OnUpload
- OnAssign_Page
- OnMove_Page
- OnPasteSpecial
- OnRollback
- OnEmptyRecycleFolder
- OnMoveTaxonomy
- OnCategoryCreated
- OnCategoryDeleted
- OnCategoryRenamed
- OnPageCategorizationChange
- OnAssetCategorizationChange
- OnCheckInAsset
- OnCheckOutAsset
- OnAssignAsset
- OnCopyAsset
- OnDeleteAsset
- OnEmptyAssetRecycleFolder
- OnMarkForPublishAsset
- OnMoveAsset
- OnRenameAsset
- OnRollbackAsset
- OnUndoCheckOutAsset
- OnWorkflowAdvance
- OnWorkflowAdvanceAsset
- OnEntitySave
We will be expanding this list of custom hooks on a regular basis. Check back soon for more!
There are no comments yet.