Links permit us to add buttons and action links and also to load javascript and CSS into the application.
To register these actions into coreBOS we use the vtlib API interface addLink() method:
include_once('vtlib/Vtiger/Module.php'); $moduleInstance = Vtiger_Module::getInstance('ModuleName'); $moduleInstance->addLink(<linkType>, <linkLabel>, <linkURL>, <IconPath>);
LinkType | Type of Link (see below) |
LinkLabel | Label to use for the link when displaying |
LinkURL | URL of the link. You can use variables like $MODULE$ and $RECORD$ which will be replaced with the values of the current module and crmid |
IconPath | full path to an icon that will be used in the right action panel |
You can find a real example in the add Action Link Helper Script
Type | Usage |
---|---|
DETAILVIEWBASIC | Link on the right action panel of a record |
DETAILVIEW | Hover menu on the right action panel of a record that contains the link |
DETAILVIEWWIDGET | A block of code contained in a box on the view of a record. It can either be a small box on the action panel or a full fledged block inserted into the existing field blocks |
LISTVIEWBASIC | Button on the top of the list view of a module |
LISTVIEW | Hover menu on the top of the list view of a module that contains the link |
HEADERLINK | Hover menu on the top of the browser screen that contains the link. It appears next to the Preferences icon and is a global action link |
HEADERSCRIPT | Permits the inclusion of a javascript file located in the application |
HEADERCSS | Permits the inclusion of a CSS style file located in the application |
HEADERSCRIPT_POPUP | Permits the inclusion of a javascript file located in the popup screen of the application |
HEADERCSS_POPUP | Permits the inclusion of a CSS style file located in the popup screen of the application |
PRESAVE | Permits us to launch code when the user clicks on the SAVE button BEFORE the operation is done. We will be able to execute code in the PHP application and force the execution of a javascript function. The javascript function takes full control of the save process which means that it must submit the form if it decides to. In order to do that it will receive the parameters: edit_type, formName, action, callback, any parameters sent by the php code |
Note!
Get more details in the How to add action links to a module development tutorial.