addButton

Availability: >= 2.0

Type: Object Method

Description: Registers a new custom button AND adds it to the toolbar layout in one step.

Syntax:

$editor->addbutton(string $namestring $locationstring $functionstring $URL[, int $width[, int $height[, string $ButtonStateHandler]]]); 

This function is depreciated, please use registerButton and addRegisteredButton instead. 

Parameters:

$name
Name will appear as a tool tip when users mouse over the button and will also be used as the button identifier name so that you can position other buttons around your new button.
 
$location
Location specifies where to place the button on the toolbar. To place the button after a specific button this value should be 'after:' followed directly by the identifier name for the button you want to position the button after.  To place the button before a specific button this value should be the word 'before:' followed directly by the identifier name for the button you want to position the button before.  For example to add the button after the print button this value should be set to 'after:print', to place the button before the print button this value should be set to 'before:print'.
 
$function 
Function should be the JavaScript function to perform when users click the button.
Please see the section on JavaScript API for a list of available JavaScript methods.
 
$URL 
URL should be the web address to the image you want to use as the button.
 
$width
Width is optional and sets the width of the button.
 
$height 
Height is optional and sets the height of the button.

$ButtonStateHandler
ID name of the button state handler that should control the selection state in which your button should appear disabled, latched etc.

You can register a new button state handler using the addJSButtonStateHandler PHP API method or the addButtonStateHandler JavaScript API method.

All parameters support placeholders

General examples:

To add a new button after the hyperlink button:

$editor->addbutton('My New Button''after:link''myFunction()''/images/button.gif'2222);

To add a new button before the print button:

$editor->addbutton('My New Button',  'before:print''myFunction()''/images/button.gif'2222);