-
Notifications
You must be signed in to change notification settings - Fork 2
Plugins
Home > Plugins
Plugins are a lot like helpers in that they are another abstraction layer of code that can be reused throughout the framework. The difference is that helpers are only one file and plugins allow you to have multiple files. Plugins follow the same naming convention as everything else but because they can have many files they have to be stored in a folder so they go a bit deeper than Models, Controllers, or Helpers do. The naming convention is shown in the example bellow.
<?php
/* The plugin class. */
$plugin = new ShippingCalculator_Plugin();
/* The plugin folder. */
plugins/shipping.calculator/
/* The plugin's main class file. */
plugins/shipping.calculator/shipping.calculator.php
?>There may be a case when you are using a plugin that is using certain functionality that may not be supported by the version of the framework that you are using. As a result there are 3 variables that can be setup in the plugin class that helps you to make sure that your plugin will be supported. These variables are optional but can be very helpful when you are wanting to setup a plugin that you intend to reuse on multiple projects. These variables are set in the main plugin class.
<?php
/* When set this option will only allow the plugin to load if the System.mode matches the set string bellow. */
public $requiredSystemMode = "production";
/* When set this option will only allow the plugin to load if the System.version is not lower than the defined version. */
public $minimumSystemVersion = "1.0.0b";
/* When set this option will only allow the plugin to load if the System.version is not higher than the defined version. */
public $maximumSystemVersion = "2.0";
?>