Omeka is an excellent platform for Digital Humanities projects and a potentially great starting point for individuals starting with PHP, Web Development, and Digital Humanities. However, so far my experience trying to work with plugin develop in Omeka using it’s existing documentation has been a struggle. Simpler language and elaboration on basic concepts would have made for an easier experience and let Omeka become more accessible so it may act as a springboard into the realm of Digital Humanities. This blog post overlays this overall impression of the Omeka plugin development tutorials and the general concepts I took away.
In an attempt to gain a basic understanding of plugin development in Omeka, I reviewed these following Omeka tutorials:
- Plugin Directory Structure
- Best Practices for Plugin Development
- Understanding Hooks
- Understanding Filters
- Understanding Omeka_Plugin_AbstractPlugin
The tutorials taught me how some parts of Omeka works and some plugin design concepts. The examples that the tutorials used were extremely helpful for introducing new concepts. I found the Plugin Directory Structure tutorial with its simple language to be the most understandable of the tutorials, but most of the tutorials seem targeted to people who already possess an intermediate knowledge of Omeka. Thus, as a new user with a limited understanding of Omeka, learning plugin development from the tutorials has been a struggle for me.
The main struggle I experienced with the tutorials came from the numerous unfamiliar terms and topics introduced and left undefined. These terms are either a technical term or Omeka terminology. One example of this is when the Understanding Hooks and Understanding Filters tutorials assume the user is familiar with using callback functions. As someone who just learned the basics of PHP, it took me awhile to wrap my head around the concept of callback functions and until I did, I couldn’t understand much about hooks and filters. A short description of what callback functions are, an example of one being used and a diagram of one in action would have improved the clarity of those two tutorials for new users like me.
When the tutorials include Omeka terminology, such as views, options, forms, saving, and records, I could pick up their general meaning from context, but without a clear understanding of these basic concepts, the learning curve for these tutorials was much higher than needed. An Introduction To Omeka tutorial outlining Omeka’s basic design, describing necessary concepts, and defining key terminology would be invaluable for new users. In addition, a PHP For Omeka tutorial could help those with little PHP experience. Some diagrams showing Omeka’s general structure would be helpful for visual learners. Overall, if a section of the tutorials assumed the reader has minimal knowledge of both PHP and Omeka, new users could learn plugin development in Omeka with greater ease and Omeka would be more accessible as a learning platform for the Digital Humanities community.
GENERAL IDEAS FROM TUTORIALS
While not targeted towards new users, these tutorials do contain a surplus of useful information and these are the general ideas I took away from them:
- You start building a plugin by creating the folder that will contain your plugin ini file, which contains general information about your plugin, and the other plugin files.
- When building a plugin you use hooks and filters.
- Hooks are a set of functions that send messages up through different parts of Omeka (see Understanding Hooks). They are activated at regular points in the Omeka code and you can add your own functions onto a preexisting hook so it will be called at those regular points in the code.
- Filters modify information and like hooks are activated at regular points in the code (see Understanding Filters).
- You can add your own functions calls in a filter to add data, such as adding an additional link to the navigation link array.
- When building a plugin, you’ll want to use Omeka’s AbstractPlugin class that keeps hooks and filters in sets of arrays and allows for different sets of options to customize the plugin class.
- To query Omeka’s databases, you can use the Omeka_DB_Table class that returns the data as Omeka’s Record objects.
In short, Omeka uses on sets of functions called hooks and filters that are activated throughout the program. You can modify these for custom functionality. Omeka also has predesigned classes for its plugins, records, and database querying that you can use.
GOING DEEPER: BEST PRACTICES
Omeka lists a number of best practices in its best practices in Omeka plugin development tutorial. While the first couple of these are easy to understand for those with the briefest exposure to coding, they become more and more complex as you continue through the tutorial. This is what I took away when reading it.
Some best practices in Omeka plugin development include:
- Make methods camelCase and start private and protected methods with an underscore.
- Be careful to not change standard Omeka behavior when overwriting methods.
- Use View Helpers, which are helper methods for the view class, instead of global functions, which pertain to the whole of the class.
- Send all processes that may run longer than a typical web process to a job by creating a class that extends Omeka_Job_AbstractJob and running a function from it. Either run using default or long-running depending on how long it’ll take.
- Set up your plugin’s configuration page using the framework Omeka provides for you. When a user installs or upgrades your plugin, Omeka redirects the user to the configuration page. The data the user submits on that page is sent as a POST (an array of data from the submitted form). You can use the config_form hook to handle that POST and update the options or other settings. You can keep the code to do this in a config_form.php include file.
- Omeka lets you build forms for records with different options available.
- Use Omeka’s search_query_types filter and the search_sql hook to add a new search type to Omeka’s search form. This can make your record full-text searchable and customize it with three search query types: keyword (full text), boolean, and exact match.
Overall, it seems to say that one ought to become familiar with classes and tools that Omeka provides and work with them in ways that are efficient and won’t disrupt the normal process of Omeka.
Omeka is a powerful content management system for Digital Humanities project and could be a great starting point for those beginning Digital Humanities work with a slight shift in intended audience in the documentation. Currently it uses advanced language and it assumes a familiarity with programming concepts and Omeka terminology, but with a chance of language, elaboration on new concepts, and more references to other resources it could become much more accessible for new users. For those who are new users, the current tutorials do contain useful content even if they have a high learning curve. They explain the sets of functions called hooks and filters that Omeka activates throughout its files. They also introduce you to Omeka’s plugin, record, and database querying classes that you can use. In terms of best practices, one wants to become familiar with classes and tools that Omeka provides and use them efficiently while not disrupting Omeka’s the normal running process. Overall, it would be helpful for new users if the tutorial were more accessible, but even if they’re hard to comprehend, they still contain useful information.