Making a plugin for OJS3

I have a feeling that this would be a problem with any plugin using that hook and maybe also with the other hook you mentioned if other plugins use that. I will test embedGalley next week together with the other plugin. Maybe Alec with comment by then.

I have worked sightly with Smarty templates. That’s how working peace of code looks like:
https://github.com/Vitaliy-1/JATSParserPlugin/blob/master/templates/articleMainText.tpl

Here I have just iterated through journal article reference item object
@ajnyga, @asmecher, what do you thin about writing to Smarty templates this way? I mean is this OK to iterate through objects in template file? Or it is not OK in terms of speed or security? Don’t know Smarty so it’s better to hear yours point of view before writing actual code.
The final work will have presumably 500 lines of code. It would be broken into several template files for readability.

1 Like

I do not know about speed, but there are a lot of similar iterations in OJS.

Hi all,

On the issue of giving hook registrations various priorities, see this merged PR: pkp/pkp-lib#1815 Permit hooks to register with call priorities by asmecher · Pull Request #2318 · pkp/pkp-lib · GitHub

This has been merged for release with OJS 3.1.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi @asmecher,

After applying this patch how can I change priority?

Hi @Vitaliy,

After this is applied, when registering for the hook, you can (optionally) specify an additional parameter with priority:

HookRegistry::register('myHook', array($this, 'callback'), HOOK_SEQUENCE_NORMAL);

The HOOK_SEQUENCE_… constants are HOOK_SEQUENCE_CORE, HOOK_SEQUENCE_NORMAL, HOOK_SEQUENCE_LATE, and HOOK_SEQUENCE_LAST (in order of high to low priority).

Regards,
Alec Smecher
Public Knowledge Project Team

2 Likes