Plugin for a new section within Production tab


I want to create a generic plugin to add a new section in Production (URL: http:///ojs/index.php//workflow/index//).

The section is intended to be a HTML DIV, with a new set of buttons, which need to have a different behavior.

Sadly I couldn’t find any plugin that performs something like this, while searching for it, I have some questions:

  1. How do I create a new template and how do I inject it in that specific section using the plugin ?

  2. What is the correct hook to be used for this task? I currently found Templates::​Editor::​Index::​Submissions, which according to the docs is Called at the end of the bulleted list in the Submissions section of the editor’s page, is that the correct one?

  3. How do I send the correct information to the template, I need to show the buttons unders some conditions, which I need to fetch from the DB and then using some Smarty ifs for them.

  4. How do I add new CSS & JS for the buttons to include them into the plugin? I need to create and show a Modal when pressing one of them, and the example says nothing about something as complex as this.

Any help/current example in OJS would be appreciated.

Kind regards, Jose

Hi @Jose_Ares,

Your best bet for intervening within Smarty-based content may be a Smarty filter. See e.g. this thread: How to create a plugin to change a button behavior - #2 by asmecher

It can be a little clumsy but as far as I know it’s the only way of extending content within a Smarty template, unless there’s a fortuitously-placed hook already in the template you want to modify.

You can look e.g. at the ORCID profile plugin (GitHub - pkp/orcidProfile: A plugin to pull ORCID information into a PKP user profile) for some code that does this. Make sure you’re looking at the branch matching your version of OJS – the conventions are different depending on whether you’re using a Smarty2 vs. Smarty3-based version of OJS.

Alec Smecher
Public Knowledge Project Team

Hi @asmecher

This doesn’t sound promising at all, the total contrary actually.

Can I just add a new hook for that template? I’m looking the easiest way to do this to be honest, without the hassle of digging into the Smarty manual to do something that can be done in a more straightforward way.

My point is, is there a specific place where I can create a new hook for this? Even if it’s in the core codebase would be ok for me.

Kind regards Jose

Hi @Jose_Ares,

If you think a hook would be generally useful to add to the codebase, then feel free to propose it as a pull request. That way it can be included in future releases.

If not, I would suggest modifying the code to add this feature rather than writing a plugin that requires modifications to the core codebase. The whole point of writing plugins is that they can be self-contained, and a plugin that requires a new hook to be added would break that.

Alec Smecher
Public Knowledge Project Team