[Koha-bugs] [Bug 34713] Standardize plugin hooks

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Sep 5 17:36:23 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34713

--- Comment #3 from Pedro Amorim <pedro.amorim at ptfs-europe.com> ---
(In reply to Marcel de Rooy from comment #1)
> The ->call pattern is more recent. I think we should go in that direction.

Great! I agree. I think any eventual future documentation should have this as a
pattern to be adopted (for new hooks being added in the future).

(In reply to Julian Maurice from comment #2)
> I think standardizing name cannot be a bad thing, but the thing that matters
> the most (to me at least) is a proper documentation of the hook arguments:
> what they contain and if (and how) they are used after the hook returns.

Yes, I agree and this is something I left out of my initial post but something
I strongly believe we need: Proper documentation (and usage examples) of all
available plugin hooks, as well as their arguments and return value - if any.
The best closest thing we have atm is the kitchen sink plugin's actual code
imo.

@Marcel the idea behind "filter" versus "action" would be to make it clear,
right off the bat, to anyone implementing any hook whether it just triggers an
action (and has no return value) e.g. after_biblio_action or if the hook
filters some args and returns that after some modifications have been made 
e.g. patron_barcode_transform

I only used the naming argument as a starting point of discussion regarding
standardization and I don't feel strongly one way or another. I started that as
a suggestion but I believe the main 2 issues are:
- Hooks are not standardized - each hook has its own way of handling arguments,
and in different ways, or no arguments at all.
- Docs are poor, the koha plugin hooks page is better than nothing but a bit
lacking in terms of dev documentation or usage examples.

On a wider topic:
https://perldoc.koha-community.org/ - Doesn't look like it's been maintained
(20.05 is the latest listed there). And looks ugly =D
I wonder if we could use something like https://about.readthedocs.com/ for
Koha, to document patterns we use, not just plugin related.
Or a (better) way of getting documentation generated using POD from the code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list