A plugin is a collection of code and resources which can be dropped in to any esoTalk installation to add additional functionality. Plugins are stored in the
In addition to reading this documentation, a good way to learn how plugins work is to look through the code of existing plugins.
A plugin has the following file structure:
||The name of the plugin in StudlyCase.|
||The main plugin file, where all of the plugin's information and logic is located.|
||A 16x16 icon which is displayed on the Administration > Plugins page.|
||An empty file to prevent the directory from being publicly listed.|
||The plugin's publicly-accessible resources (CSS/JS files, images, etc.)|
||The plugin's views (see Concepts.)|
||Anything else you may need: class files, libraries, includes, etc.|
plugin.php file contains two important things: an array of details about the plugin (name, author, etc.) and a class which encapsulates all of the plugin's logic (discussed on the next page.)
Plugin details should be added to the
ET::$pluginInfo array at the top of
plugin.php. The key must correspond to the name of the plugin's folder.
Defining Plugin Details
ET::$pluginInfo["ExamplePlugin"] = array( "name" => "Example Plugin", "description" => "An example plugin.", "version" => "1.0", "author" => "Toby Zerner", "authorEmail" => "[email protected]", "authorURL" => "http://esotalk.org", "license" => "GPLv2" );
Dependencies may be specified as an array under the
dependencies key. For each item in the dependencies array, the key may be "esoTalk" or the name of a required plugin, and the value is the minimum version required. If these dependencies are not met, enabling the plugin will not be allowed.
Specifying Plugin Dependencies
ET::$pluginInfo["ExamplePlugin"] = array( // ... "dependencies" => array( "esoTalk" => "1.0.0g3", "AnotherPlugin" => "1.3" ) );
Ideally, you should version-control your plugin and create a repository on GitHub. The
plugin.php file should be at the top-level of the repository; there should be no parent folder.