Keyword

Passing parameters to K2 plugins?

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 11 months ago #88958 by BNR Investment Group
Passing parameters to K2 plugins? was created by BNR Investment Group
Is it possible to pass parameters to a K2 plugin through the various K2 events? For example, can I add or change an expected parameter when K2AfterDisplayContent is set?

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #88959 by Jiliko.net
Replied by Jiliko.net on topic Passing parameters to K2 plugins?
Hi Brent,

What kind of parameter do you want to change ? K2 param, item param, Plugin param ?

The K2 params are passed to the plugin by reference, so you can change them and it will affect the params in the K2 view that has triggered the event.

Olivier

Please Log in or Create an account to join the conversation.

  • BNR Investment Group
  • BNR Investment Group's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 11 months ago #88960 by BNR Investment Group
Replied by BNR Investment Group on topic Passing parameters to K2 plugins?
Hi Oliver,

We're working with a 3rd party plugin that is triggered by the K2 event K2AfterDisplayContent. Since this event is in both the default K2 item and k2 content module, the plugin runs in both areas. The plugin does not have a parameter to keep it from displaying in a module so we'd like to modify the plugin parameter that keeps the plugin from displaying by passing that parameter in the module. Right now, we've simply removed the K2AfterDisplayContent event from the module, but that effectively turns off all K2 plugins, we just want to turn one off.

Ideally, the best solution is to add another parameter to the plugin to allow an admin to decide whether the plugin runs in a module or not, but it got me thinking about doing it this way to prevent the site from breaking in the future should the plugin be updated.

Thanks,
Brent

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum