Working on a Citation plugin, and need to override some core code. Specifically, I need to override the /application/models/Item.php file. I copied the file into my plugin directory (/plugins/Citation/models/Item.php) and made the modifications there (none of which affect the database.) Now, how do I get Omeka to use this file over the original core when my plugin is installed? Thanks
There’s not really a way to completely override a core model via a plugin, but there are many hooks and filters available. What is the effect you are looking for?
Patrick, Thanks for the reply! In /application/models/Item.php I’m trying to overwrite the function getCitation() to allow for different formatting of the citation. All the other pieces of this are straightforward, but I need to override this function to allow for printing of the citation in different formats. Thanks.
For that, you’ll want to use the item_citation filter. That will let you dig up whatever data you need from the item and rewrite the citation from a plugin.
Thanks again for the reply! That was exactly what I needed. I’m so used to using override directories with Zend that I didn’t do my research due diligence on hooks…
(Side note, any community use for a plugin that allows for citations to be switched between APA, MLA, Chicago, Turbain, etc? Pretty simplistic implementation-wise but its what we needed, so someone else may as well)
I think your idea about a plugin that allows for citation style to be selected from a large range of options is a very good one. Should you decided to implement, here you can find code for Wikipedia format: https://github.com/DBinaghi/plugin-WikipediaCitations
An extra feature could be an (ajax?) composer, that let user create their own citation style by basically giving them the metadata fields and a wysiwig editor…