Skip to content
idefix6 edited this page Sep 29, 2014 · 15 revisions

There is a new plugin architecture which will be available from ViMbAdmin V3.

There are two types of plugins:

  • system plugins - plugins which are bundled with ViMbAdmin;
  • non-system / third party plugins - these will be available through modules (standard Zend Framework structure).

Examples

  1. System Plugin - Plugins: Access Permissions

Plugin Discovery and Setup

Plugins are discovered automatically when a controller extends ViMbAdmin_Controller_PluginAction. This implements an observable behavior which means it implements a notify() function to call plugin hooks.

The application/plugins directory and application/modules/*/plugins directories are scanned for plugins.

notify() takes three arguments - the controller name (eg. mailbox), the action name (eg. add), the hook name (eg. addPrepare) and the self reference to the action.

Plugins implement an update() method which, typically, reflects on its own object and calls a function made up of this data if it exists. e.g. $this->mailbox_add_addPrepare().

Available Hooks

We will list available hooks here. Please open a pull request to add additional hooks.

Hooks for Aliases

  • Adding / editing aliases
    • alias_add_formPostProcess - called after the add / edit form has been instantiated;
    • alias_add_addPrepare - called at the start of the add/edit process;
    • alias_add_addPrevalidate - called just before $form->isValid() is called;
    • alias_add_addPostvalidate - called just after a successful $form->isValid();
    • alias_add_addPreflush
    • alias_add_addPostflush
  • Deleting Aliases
    • alias_delete_preRemove
    • alias_delete_preFlush
    • alias_delete_postFlush
  • Other Actions
    • alias_toggleActive_preflush
    • alias_toggleActive_postflush
    • alias_toggleActive_preToggle - can be used to check if the alias is allowed to be toggled

Hooks for Mailboxes

  • Listing mailboxes
    • mailbox_list_listPostProcess - called after the core code for listing mailboxes has executed;
  • Adding / editing mailboxes
    • mailbox_add_formPostProcess - called after the add / edit form has been instantiated;
    • mailbox_add_addPrepare - called just before we determine if an add / edit form has been posted;
    • mailbox_add_addPrevalidate - called just before $form->isValid() is called;
    • mailbox_add_addPostvalidate - called just after a successful $form->isValid();
    • mailbox_add_addPreflush - called just before the database is flushed;
    • mailbox_add_addPostflush - called just after the database is flushed;
    • mailbox_add_addFinish - called just before the final redirect()

Hooks for Archives

  • archive_add_preSerialize
  • archive_add_preFlushAdd
  • archive_add_postFlushAdd
  • archive_add_prePurge
  • archive_add_preFlushPurge
  • archive_add_postFlushPurge
  • archive_cancel_preFlushRestore
  • archive_cancel_postFlushRestore
  • archive_cancel_mailboxRestored
  • archive_deletePendings_preRemove
  • archive_deletePendings_postRemove
  • archive_restorePendings_preFlushRestore
  • archive_restorePendings_postFlushRestore
  • archive_restorePendings_restored

Hooks for Export Settings

  • export_settings_thunderbird_preSetSettings