Omeka_Plugin_AbstractPlugin

Package: Plugin

class Omeka_Plugin_AbstractPlugin

Abstract plugin class.

Plugin authors may inherit from this class to aid in building their plugin framework.

property _db

protected Omeka_Db

Database object accessible to plugin authors.

property _hooks

protected array

Plugin hooks.

In the child class plugin authors should set an array containing hook names as values and, optionally, callback names as keys. If a callback name is given, the child class should contain an identically named method. If no callback key is given, the child class should contain a corresponding hookCamelCased() method. E.g: the after_save_form_record filter should have a corresponding hookAfterSaveRecord() method.

For example: <code> array(‘install’, ‘uninstall’, ‘doSomething’ => ‘after_save_item’) </code>

property _filters

protected array

Plugin filters.

In the child class plugin authors should set an array containing filter names as values and, optionally, callback names as keys. If a callback name is given, the child class should contain an identically named method. If no callback key is given, the child class should contain a corresponding filterCamelCased() method. E.g: the admin_navigation_main filter should have a corresponding filterAdminNavigationMain() method.

For example: <code> array(‘admin_navigation_main’, ‘public_navigation_main’, ‘changeSomething’ => ‘display_option_site_title’, ‘displayItemDublinCoreTitle’ => array(‘Display’, ‘Item’, ‘Dublin Core’, ‘Title’)) </code>

property _options

protected array

Plugin options.

Plugin authors should give an array containing option names as keys and their default values as values, if any.

For example: <code> array(‘option_name1’ => ‘option_default_value1’, ‘option_name2’ => ‘option_default_value2’, ‘option_name3’, ‘option_name4’) </code>

__construct()

Construct the plugin object.

Sets the database object. Plugin authors must call parent::__construct() in the child class’s constructor, if used.

setUp()

Set up the plugin to hook into Omeka.

Adds the plugin’s hooks and filters. Plugin writers must call this method after instantiating their plugin class.

_installOptions()

Set options with default values.

Plugin authors may want to use this convenience method in their install hook callback.

_uninstallOptions()

Delete all options.

Plugin authors may want to use this convenience method in their uninstall hook callback.

_addHooks()

Validate and add hooks.

_addFilters()

Validate and add filters.