I'm putting together some functionality for a client, and its boiling down to 2 separate plugins that need to interact with each other (it needs to be 2 plugins because he's installing this in multiple places, and not every place will get both sets of functionality). To accomplish this interaction, I've started adding a few actions and filters in my code (not calling wp hooks, creating new ones to call). I've now got a particular problem that I'm struggling with, and I think someone with a little more experience, or maybe a better understanding of good design patterns can help me.
I have a situation where I need the second plugin to access a variable and return it to the first. Because I need to return the variable back to the original function, I first assumed that I'd want to use a filter. However, I need access to a second variable as a reference to be able to run the modifications on the first.
I could run it as an action, and pass both in, but then I'm unable to return the values to the original function. As far as I know, running it as a filter only allows one variable to be passed through.
The only thing I can think to do is declare the second variable I need (which is only for reference, I dont need to modify it) as global, and access it from my hooked in function, but this seems like the "wrong" way to do it. Anybody have any suggestions?