This page is outdated
The information on this page concerns an old or obsolete version of Omeka. If you are using a more recent version, instead see Hooks on Omeka's Read the Docs site.
The following plugin hooks are part of Omeka's Plugin API:
General Hooks
These general plugin hooks are used for basic plugin features, installing, configuring, and controlling access.
Theme Hooks
Theme hooks allow plugins to add content to various sections of Omeka's interface. A plugin using one of these hooks can output HTML directly onto Omeka pages in a way that works across many different themes.
Admin Theme
- admin_theme_header
- admin_theme_footer
- admin_append_to_dashboard_primary
- admin_append_to_dashboard_secondary
- admin_append_to_item_form
- admin_append_to_items_show_primary
- admin_append_to_items_show_secondary
- admin_append_to_items_browse_primary
- admin_append_to_items_browse_detailed_each
- admin_append_to_items_form_tags
- admin_append_to_items_form_files
- admin_append_to_items_form_collection
- admin_append_to_users_form
- admin_append_to_collections_browse_primary
- admin_append_to_collections_show_primary
- admin_append_to_collections_form
- admin_append_to_item_types_browse_primary
- admin_append_to_item_types_show_primary
- admin_append_to_item_types_form
- admin_append_to_advanced_search
- admin_append_to_plugin_uninstall_message
Public Theme
- public_theme_header
- public_theme_footer
- public_theme_page_header
- public_theme_body
- public_theme_page_content
- public_append_to_items_browse_each
- public_append_to_items_browse
- public_append_to_items_show
- public_append_to_collections_browse_each
- public_append_to_collections_browse
- public_append_to_collections_show
- public_append_to_advanced_search
Database Hooks
Generic Record Hooks
The following hooks are fired after or before any model being used, regardless of what model they are. For example, after_save_record hook is fired when after both an item being saved, as well as a collection or file.
Specific Record Hooks
Database hooks that begin with "before_" and "after_" are implied and exist for every model that is defined, including models defined by plugins. Below are just a few of the available before/after hooks. The available events are save, save_form, delete, insert, update, and validate.
Implied hook structure
[before|after]_[event]_[record name]
Example of implied hook in use
Pre- Omeka 1.5:
<?php add_plugin_hook('after_save_item', 'plugin_name_after_save_item'); ?>
Omeka 1.5 and later:
class MyPlugin extends Omeka_Plugin_Abstract { protected _$hooks = array( 'after_save_item' ); public function afterSaveItem($item) { //do something with item } }
For example, below are all the possible implied hooks for Items. These hooks will only fire when the corresponding action has occurred to an Item record.
- after_save_item
- before_save_item
- before_save_form_item
- after_save_form_item
- before_delete_item
- after_delete_item
- before_insert_item
- after_insert_item
- before_update_item
- after_update_item
- before_validate_item
- after_validate_item
Miscellaneous Hooks
Browse/show hooks
Additional hooks exist for browse and show pages for many record types. browse_record hooks are passed an array of that record type. show_record hooks are passed the record.
Here are some examples:
- show_itemtype
- browse_itemtypes
- browse_items
- browse_tags
- browse_collections
- browse_users
- show_item
- show_user
- show_collection