Changing code on the fly


I’d like to add a “duplicate item” option to the system, and would like to keep it as a plugin so that people can decide whether to enable or disable such a function (plus, it would be easier to keep when Omeka core files get updated).

As for now, I’m thinking I should add the link to the function in Dashboard, in Items and in Items/Show. In this last page, it could be a button, but in the previous two ones it should be a link, as we now have Delete and Edit.

I could easily change the code of those pages by creating new ones, but as said I’d prefer to do it on the fly. Is there a way to do it? Any way, for instance, to refer to the content of the page and change it before it gets shown?

Thanks for any hint.

1 Like

And, if there was no way to change the code on the fly, where should I store the modified copies of the system pages, in order to keep the core originals intact?


There are a few different options for changing the markup on Omeka’s pages, but the usual one is to use hooks or filters.

We don’t have one for adding to the buttons on the item show page, but we do have one for adding to the buttons on the edit page, as well as for generally adding to the sidebar area.

Hello, John.

Would the hook admin_head a good solution to change the code inside the pages, in order to add the links I need (I suppose I could use some js to find the right position and add some extra code)?

I have no idea how to use that hook, though. Could you point me to some example code?


This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.