Context in plugins for OJS 3/OMP 1.2

,

All the plugins I can see for the New World Order use $context = $request->getContext() or sometimes Request::getContext(). The API doc says that’s deprecated, and to see PKPPageRouter::getContext(). However, that doesn’t seem to work the same way—what’s the preferred generic way to get the context in which a plugin is operating?

Hi @crism,

I would suggest sticking with $request->getContext, whenever possible. You can generally get the request object from the registry if you don’t have it passed in directly via e.g. the plugin API. That’s the most consistently used approach throughout the codebase, and when I get a chance to go over it I’ll remove the deprecation note on $request->getContext.

Regards,
Alec Smecher
Public Knowledge Project Team

OK, thanks. I’ll disregard the deprecation notice.