forked from bastos/nicedog
-
Notifications
You must be signed in to change notification settings - Fork 1
Plugins
jetviper21 edited this page Sep 13, 2010
·
4 revisions
Nimble will have default plugins such as form_builders, javascript helpers, link helpers. etc
but you can also define your own custom plugins to be loaded by setting the plugins_path config option
- note custom plugin names override those that come with nimble so if you want to roll your own form_helper feel free to name it form_helper
Nimble::set_config('plugins_path', '/my/full/path');
Plugins get loaded in 2 places globally in your index.php and at the controller level examples below
Global:
Nimble::load_plugins(‘form_helper’, ‘link_helper’);
Controller:
class Mycontroller extends Controller {
public function __construct() {
$this->load_plugins('form_helper', 'link_helper');
}
}
Making custom plugins:
A plugin needs to have the minimum directory structure:
- custom_plugin_directory
- my_plugin
- init.php
- my_plugin
init.php gets called when you call load_plugins so all your requires for that plugin need to be handled here.