Announcement Type backend tab

I am trying to write a plugin to add more support to the Announcement Types. I cannot understand where is fetched the frontend elements of the page “management/settings/announcements#announcementTypes”. It seems to me that this is the right template to analyze: https://github.com/pkp/pkp-lib/blob/main/templates/management/announcements.tpl but I cannot understand how it’s working since it just calls “AnnouncementTypeGridHandler”, but no HTML is defined.

Hi @Lara_M

In that template you linked, it does indeed reference AnnouncementTypeGridHandler, and you’ll also see in that call that the “op” is “fetchGrid”, which is what method is actually called in the referenced handler. It is defined in the parent class, here:

And you’ll see that ultimately this returns a JSON version of the template used universally to build a grid.

Best
Jason

1 Like

Thank you very much! So if I want - for instance - add another column and elements in the tab, do I have to work at what level?
Is it right if I create a new GridHandler that expands this or should I expand the AnnouncementTypeGridHandler? Sorry for asking, but the structure is very nested, so it’s hard to find the right way!

Hi @Lara_M

Whether or not you feel like you need to create a new GridHandler is probably up to you, but for me it usually depends on how big the change is. If I end up modifying the database and need to change DAO classes and such then that’s fairly major and I’d probably do it in a plugin with its own schema. For smaller changes I might just change the core classes and commit those changes as a local customization in a git branch.

For your question regarding columns in the grid, if you look in the handler I linked, columns can be added using the addColumn method like this:

there’s only one column in the Announcement type grid (the name) so this is only called once. What you can do to that column are defined in the GridRow (the blue links under the row) and GridCellProvider (what happens if you click on the name of the announcement type).

You’re right, it’s pretty nested. When I was working on the first version of OMP back in 2011 this was heavy stuff for me too.

Best
Jason

1 Like

Hi @jnugent,

sorry for the late reply. I am actually creating a plugin, so I was wondering what was the best way to operate. Thank you for the explanations!

Best,
Lara