Summary: | Adding hooks to the plugin system | ||
---|---|---|---|
Product: | Koha | Reporter: | Stefan Berndtsson <stefan.berndtsson> |
Component: | Architecture, internals, and plumbing | Assignee: | Bugs List <koha-bugs> |
Status: | In Discussion --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | arthur.suzuki, dcook, emma.ternrud, fridolin.somers, glasklas, kyle, magnus, viktor.sarge |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Attachments: |
Bug in run_matching when plugins are not available
Adding hooks to the plugin system |
Description
Stefan Berndtsson
2017-09-13 09:38:50 UTC
Created attachment 67108 [details]
Bug in run_matching when plugins are not available
Created attachment 67109 [details] [review] Adding hooks to the plugin system >This plugin edits a query beginning with "Provider:" to do "publisher:" instead. A simple example that when using Elasticsearch makes publisher links in the bibliographic detail view clickable. The current XSLT uses the Zebra based links, that result in an unusable search. This is not meant to be the solution to the Zebra/Elasticsearch conflict in the XSLT, but it's a simple demonstration of the hook feature.
Maybe this should be filed as a separate bug?
This adds a very nice convenience method. I'd love to see a followup to replace the existing bespoke looks for opac hooks, staff hooks, and payment plugins if we are to add this. The way I see this there are three kinds of "plugins". This idea adds a fourth. 1. Report-plugin. 2. Tool-plugin. 3. "Normal" plugin. 4. "Hooks". The normal plugin is meant to run once, in a very particular circumstance where the result of the plugin isn't necessarily meant to be passed on to any other plugin. An example here is the to_marc feature used when importing records. Input can be CSV and output is MARC. A hook on the other hand is meant to return data in the same format as it was received, so that they are chainable. Multiple plugins can be available for the same hook. An example for this case could be modifying MARC-data on its way to the database (for those familiar with Rails, this would be similar to a before_save hook), or adding extra fields into the index without changing the data, in a before_index hook. We currently use the latter in our Koha instance where we want to be able to distinguish books from ebooks for example, where the qualification for these come from multiple MARC fields. The plugin used for this looks at the MARC-record, combines everything and adds a 998$a with the result which is then indexed and searchable. Many such plugins could be chained in sequence for different kinds of index-preparations. It may therefor not be sensible to replace things all throughout the code, and that 3 and 4 may need to live beside each other. Is this implemented by Koha::Plugins->call() ? Not sure what the status of this one is right now... so moving to "In Discussion" |