-
Notifications
You must be signed in to change notification settings - Fork 101
Plugins
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).
- System Plugin - Plugins: Access Permissions
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()
.
The standard workflow of hooks are normally:
<module>_<process>_pre<command> -> use to do pre checks, can be used to stop the action
|
v
<module>_<process>_preFlush -> do actions before changes are done in database
|
v
interal processing in core
|
v
<module>_<process>_postFlush -> do actions after core is commited changes to database
|
v
<module>_<process>_post<command> -> do additional actions before the workflow is finished
-
<module>
could be alias, mailbox, see below for more detailed information -
<process>
can be add, delete, see below for more detailed information -
<command>
is fixed by core, see below for more detailed information
We will list available hooks here. Please open a pull request to add additional hooks.
- 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
- called before an alias is deleted. It must return true to allow deletion or false to cancel deletion! -
alias_delete_preFlush
- called just before the database is flushed; Use this to make irreversible changes in the database. -
alias_delete_postFlush
- called just after the database is flushed; Use this to make irreversible changes in the database.
-
- Other Actions
alias_toggleActive_preflush
alias_toggleActive_postflush
-
alias_toggleActive_preToggle
- can be used to check if the alias is allowed to be toggled. Method must return true or false!
- 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; Use this to make irreversible changes in the database. -
mailbox_add_addPostflush
- called just after the database is flushed; Use this to make irreversible changes in the database. -
mailbox_add_addFinish
- called just before the finalredirect()
-
mailbox_purge_preRemove
- called before a mailbox is deleted. It must return true to allow deletion or false to cancel deletion!
-
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
export_settings_thunderbird_preSetSettings