By plugin, we are referring to an 'intercept function' that dove-tails into the current system process model built into BlueBox2.0.
Each time a standard class->method is called within the BB2 framework, a plugin can be inserted to handle the data passing through at that point.
Here is how...
- Firstly, create a php file in portal/{database_name}/custom_modules called bb_plugins.php
- The file should have the following format:
<?php
class bb_plugins extends baseclass{
...
}
?>
- Then add as many plugn functions as you require, naming them as class_name_plugin_name, ie
function bb_sales_orders_post_add(){
...
}
- The format of the plugin is also important and should have at minimum, the following:
function bb_sales_orders_post_add($conf=NULL){
global $global,$class,$method;
.....
return($conf)
}
- Standard intercept-nodes are:
- pre_view
- post_view
- pre_viewlist
- post_viewlist
- pre_get
- post_get
- pre_add_form
- post_add_form
- pre_add
- post_add
- pre_edit_form
- post_edit_form
- pre_edit
- post_edit
- pre_delete
- post_delete
- pre_truedelete
- post_truedelete
And some special instances are:
- bb_secure->pre_login
- bb_secure->post_login
- bb_datamerge->extra_data
- And that's it... from there it is up to you. You can intercept data, call other functions, do whatever you require with the data that is passed into the function via $conf, just as long as you pass it back out with return $conf at the end...
- As an extra feature, bb_plugins.php can also be used to set bbsettings dynamically.
This is done by declaring a function as class_name_bbsetting_full_name, eg:
function bb_sales_orders_bbsetting_display_name_template($conf=NULL){
global $global,$class,$method;
$value=$conf[name]." ".$conf[_id];
return($value)
}