Blog Download Documentation Forum Tasks Home
Blog Download Documentation Forum Tasks Home

Create custom AddOn for PageBuilder

This is documentation apply only to PageBuilder 3.9 or greater and will be the only format for the 4.0 branch. If you are using Drag Drop Sitecreator 2.0 or Radria 8.* please upgrade or you can use the older Add-On documented at: PageBuilder Add-on < 3.9

PageBuilder AddOn are classes that are used to insert HTML/CSS, javascript or PHP code in a web page, they optionally provide a form to customize the AddOn properties in the page.

Lets get started with the simplest possible AddOn

Sample AddOn

The AddOn is contained in one class file and to display it in the PageBuilder you will need a configuration file.

The best way to get started is to install the SampleAddOn package that contains a working AddOn you can modify and customize to create your own.

After installing the SampleAddOn you can see 2 new files in your project:


The class is what makes the AddOn the include file sample.addon.conf.inc.php load the classes and link them to the PageBuilder toolbar.



This is the only required and most important method of the AddOn. In this method you generate the HTML, PHP or Javascript code you want to insert in the page.

    public function insertInPage(Array $params) {
        $content = "<?php echo \"Your name is: ".$params['name']."\"; ?>";
        $content .= "<br>You city is:".$params['city'];
        return $content;


This method return the form that should be display to the users when they click on the layer containing the AddOn.

There are only one requirement is to store the variables name in an array called fields.

The properties are displayed on the sidebar which give only a narrow space, this is should be taken into account when building the form.

The values set by the users can be retrieve using the method: $this→getAddOnValues() that returns an Array with the fields name as key and contains their value.

    public function formProperty() {
        $values = $this->getAddOnValues();
        $form = "this is a sample form";
        $form .="<br>Your name: <input type=\"text\" name=\"fields[name]\" value=\"".$values['name']."\">";
        $form .="<br>City:<input type=\"text\" name=\"fields[city]\" value=\"".$values['city']."\">";
        return $form;


This method display a form when the users add the addon in the page or when they double click or select edit in the context menu. This form doesn't have the width limitation of the formProperty(). It uses and follow the same requirement as the formProperty()

It can be as simple as:

    public function formFullPage() {
        $form = $this->formProperty();
        return $form;


This returns an array with default fields and values of your AddOn. This can be used to directly add the addon in the page when the user click and skip the initial form. if you set to true: $direct_insert = true; This method will be called and the AddOn inserted in the page directly with the value set in that method.

    public function defaultValues() {
        $fields = Array("name" => "Philippe Lewicki",
                        "city" => "Los Angeles");
        return $fields;


This is a configuration file that loads the classes of your addOns and also update the global variable to display them in the pagebuilder AddOn tools list.

   $GLOBALS['cfg_pagebuilder_tools']['Sample'][] = "SampleAddOn";

The global variable cfg_pagebuilder_tools is an array with the following format:

$GLOBALS['cfg_pagebuilder_tools'] = Array (
       'group name' = Array ( 'Addon1 class name',
                              'Addon2 class name',

Basic AddOn

pagebuilder/custom_addon2.txt · Last modified: 2008/10/07 07:58 by admin
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki