I’m looking for a suggestion on how to solve an issue I have. I have a filter that executes a DB check on the postFilter function. The filter basically sees if an email should be generated and send out a template set up by the site admin. This function is working as expected.
The issue i have is there are some actions that i need to pass specific data to the email template that is only exposed within the action. My initial idea was to assign the needed values to a system parameter in the form of an array that could be accessed from filter function. The issue with this would be documenting each action that passes extra data.
I just wondering if there is more elegant solution… I would like to keep the system as flexible as possible for the user so if there was a way the user could setup a catch on the preFilter action that could then pass the needed information to postFilter.
Thanks all.
Since the data is generated within the action there’s no avoiding the fact that the action has to cooperate somehow in order to make the data available to whatever code ends up sending the email. Therefore I can’t see how it would be possible to not have to document that “action X exposes data Y”.
A very simple but at the same time quite adequate solution would be to have a pair of
setContextData/getContextDatafunctions on the base controller; actions set the data and the postfilter reads it.