Creating a plugin for The Secretary is a very simple and straightforward process. Plugin development is very freeform, making it quick and easy. Plugins can modify data submitted in the backend, add form fields and sections, act as a module and alter display and presentation on the frontend, as well as provide new template tags for use in themes.

File Naming and Installation

All plugins in The Secretary must end with the extension plugin.php and be in the form of plugin_name.plugin.php. If the file does not have the correct extension it will be ignored. A plugin can also be contained within it's own folder, within which sub folders can contain external libraries, JavaScript files or anything else needed.

Installing a plugin requires uploading the file (or folder) to the system/plugins folder in the Secretary installation. It will be automatically included by the system.

Hooks and Anchors

In order to modify the system in some way, a plugin must hook into it, by attaching itself to an anchor (see the full list of anchors). Anchors can give access to data (to modify a variable, for example), or simply act as an “event” (projectFormBeforeFiles lets developers insert fields into the project edit form before the file list+uploader).

Hooking into anchors is easy:

<?php 
	hook( "anchor_name", "myPluginFunction" ); 
?>

Related