Omeka_Plugin_AbstractPlugin

class Omeka_Plugin_AbstractPlugin

Package: Plugin

Abstract plugin class.

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

property _db

Database object accessible to plugin authors.

property _hooks

Plugin hooks.

In the child class plugin authors should set an array containing hooknames as values and, optionally, callback names as keys. If a callbackname is given, the child class should contain an identically namedmethod. If no callback key is given, the child class should contain acorresponding hookCamelCased() method. E.g: the after_save_form_recordfilter should have a corresponding hookAfterSaveRecord() method.

For example:

array('install',
      'uninstall',
      'doSomething' => 'after_save_item')
property _filters

Plugin filters.

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

For example:

array('admin_navigation_main',
      'public_navigation_main',
      'changeSomething' => 'display_option_site_title',
      'displayItemDublinCoreTitle' => array('Display', 'Item', 'Dublin Core', 'Title'))
property _options

Plugin options.

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

For example:

array('option_name1' => 'option_default_value1',
      'option_name2' => 'option_default_value2',
      'option_name3',
      'option_name4')
__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.