Developing plugins

From KnowledgeTree Document Management Made Simple

Jump to: navigation, search

Plugins are located in the plugins subdirectory of a KnowledgeTree install.

During startup, KTPluginUtil::loadPlugins() is called to read all plugin details. In future, this may simply read details from the database, and this procedure will only be done during plugin registration.

Plugins are found by searching for files ending with Plugin.php in the plugins sub-directory.

Plugins should create a plugin class that extends from the KTPlugin class.

class KTCorePlugin extends KTPlugin {
}

Plugins will be instantiated once, and may carry state (within the single request). The generally don't require any additional methods or attributes.

Plugins must register themselves with the plugin registry:

$oRegistry =& KTPluginRegistry::getSingleton();
$oRegistry->registerPlugin('KTCorePlugin', 'ktcore.plugin', __FILE__);

Whenever the plugin object is needed, it can be requested from the plugin registry:

$oPlugin =& $oRegistry->getPlugin('ktcore.plugin');
[

Plugins can register:

  • actions that are offered on documents and folders,
  • triggers that affect how actions perform their work,
  • portlets that can offer functionality in the sidebar of chosen pages,
  • dashlets that can provide information on a user's dashboard,
  • *admin pages* and categories that allow for customisation of a plugin's behaviour or other administration work,
  • pages that allow for pages for plugin functionality that is not an action or admin page,
  • *authentication providers* that can offer alternate ways to authentication users rather than the built-in database of users,
  • *template locations* that make plugin-related templates available,
  • *i18n locations* that make plugin-related translations available.
Personal tools