Custom Buttons

Buttons can be added under the main menu. To insert a new button use the following method:

SDK::setMenuButton($type, $title, $onclick, $image='', $module='', $action='', $condition = '');

$type : the type of button, it can be 'fixed' or 'contextual'; in the first case the button appears on the left and is always visible, in the second case the button is inserted on the right and will be visible only in the chosen module and for the chosen action.
$title : the label of the button
$onclick : the javascript code to execute. It is NOT possible to use double quotes! (“)
$image : the button image. It must be specified without path and reside in themes/softed/images folder even in the smallest version (e.g. img.png e img_min.png)
$module : if type = ‘contestual’, the module in which the button is visible
$action : if type = ‘contestual’, the action (request action) in which the button is visible
$condition : string like FunctionName:PathPhp representing a function (in the PathPhp file) to be called before showing the button. If it returns false, the button is not shown. The function has only one parameter of type reference to an array with the information of the button.

To remove the button use:

SDK::unsetMenuButton($type, $id);

$type : the type of the button
$id : the id of the button

Hooks
Smarty/templates/Buttons_List.tpl

Back to top