Many CMSs have built in "actions" and "filters". DNN's event system fulfills the the like of "actions" where you can add some custom code to do something after a particular event takes place. For example: "Every time a page is updated, send me an email".
I now have a use case where I need a "filter" rather than an "action". The difference here is that some custom code needs to execute on the object that was just modified, before committing it to the data store, rather than after. For example: "Every time a page is updated, overwrite a property of the updated page (i.e. the TabInfo object) and commit it to the data store".
This would be very useful if you want to constrain a property without making changes to the DNN core. Is there already a decent way to achieve this in DNN? If not, is it worth creating an RFC for this on GitHub?
Michael TobischDNN★MVP
Thank you, Michael and Brian.
The issue with using the TabUpdated event is that I want to overwrite the TabInfo object itself, which will put me into infinite recursion:
Line 34 will keep calling the TabUpdated method over and over again.
I could probably write my own DAL2 controller and class to directly write the TabInfo object to the DB instead of using TabController, but I thought to ask here if there's a better way along the lines of "filters", which could look something like this:
This is assuming that we can pass args.Tab by reference, such that it can be modified within the PreTabUpdated method. If not, then we could change it to return a TabInfo object rather than returning void. This is referred to as "filters" by other CMSs.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.