Summary: | A way to access the Plugin itself from a Mojolicious Controller | ||
---|---|---|---|
Product: | Koha | Reporter: | HKS3 Tadeusz Sośnierz <tadeusz> |
Component: | Plugin architecture | Assignee: | Bugs List <koha-bugs> |
Status: | NEW --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | julian.maurice |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: |
Description
HKS3 Tadeusz Sośnierz
2024-07-23 10:17:39 UTC
You can use: Koha::Plugins::Datas->find("Koha::Plugin::MyOrg::MyPlugin", $key)->plugin_value Not ideal but better than instantiating the plugin twice. A mojo helper would still require you to give your plugin name as one of the helper's arguments, right ? Not sure how we can avoid that. Not sure how to do that specifically either, but it feels like it should be possible since Koha "knows" which Plugin caused this particular Controller to be instantiated/called. Not sure if that is something that Koha keeps track of or has readily available. But afaik it is true that we have a one-to-many mapping between plugins and plugin controllers, so a controller always "belongs" to one particular plugin – so a $c->plugin or $c->app->plugin should be unambiguous. |