Credit due to @Daniel for originally posting this; I’m moving it here from the old forum.
This is just a short summary on how to update phplugins from Backlight 1 to Backlight 2 (and now Backlight 3).
It’s a good idea to look at the new sample file (backlight/custom/phplugins/phplugins-pangolin-sample.php) to see all the available functions and how the file structure is.
- Phplugins are now class based. So all functions need to be defined within a class context. This is well seen in the example file.
class PHPlugins extends APHPlugins {
// put your functions here
}
- Function names changed and lost their arguments. You only need to remove the ttg_ prefix and whatever is between parentheses.
Before:
function ttg_pallet_top_title( $style, $path ) {
echo '
// ......
';
return false;
} // END /**/
After:
// Basic structure for a PHPlugins function
function pallet_top_title() {
echo '
// ......
';
return false;
} // END /**/
- If you call another function within the PHPlugins class, you need to use
$this->my_function()
instead of just
my_function()
- Backlight 1 $style and $path arguments are accessible as
$this->style
and
$this->path
Tip:
Please first make a copy of either /backlight/custom/phplugins/phplugins-pangolin-sample.php
or /backlight/custom/phplugins/phplugins-okapi-sample.php
and give it a good name: let’s call it /backlight/custom/phplugins/site-phplugins.php
. Then select this file in your template editor as your site’s phplugins file. Add your custom functions from your Backlight 1 phplugins file and adjust them accordingly.