Module Link¶
You can add custom web link to the module using the following API:
include_once('vtlib/Vtiger/Module.php');
$moduleInstance = Vtiger_Module::getInstance('ModuleName');
$moduleInstance->addLink(<LinkType>, <LinkLabel>, <LinkURL>);
Attention
REVIEW for Vtiger 8.0
LinkType |
Type of Link like - DETAILVIEW : Will add a link in the ‘More Actions’ menu on the Detail View of the record. DETAILVIEWBASIC : Will add a link to the ‘Actions’ list on the Detail View of the Record. DETAILVIEWWIDGET : Will add a widget on the right hand side of the Detail View of the Record, similar to Tag Cloud widget. LISTVIEW : Will add a link under the ‘More Actions’ button on the List View of a module. LISTVIEWBASIC : Will add a button on the List View of the module similar to Delete, Mass Edit buttons. |
LinkLabel |
Label to use for the link when displaying |
LinkURL |
URL of the link. You can use variables like $variablename$ |
In module’s ListView handler page (modules/Payslip/ListView.php) you will need this piece of code (before the call to $smarty->display()) :
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE' => $currentModule, 'ACTION'=>
vtlib_purify($_REQUEST['action']), 'CATEGORY' => $category);
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule),
Array('LISTVIEW', 'LISTVIEWBASIC'), $customlink_params));
In module’s DetailView handler page (modules/Payslip/DetailView.php) you will need this piece of code (before the call to $smarty->display()) :
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE' => $currentModule, 'RECORD' => $focus->id, 'ACTION'=>
vtlib_purify($_REQUEST['action']));
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule),
Array('DETAILVIEW', 'DETAILVIEWBASIC', 'DETAILVIEWWIDGET'), $customlink_params));
Note
The $MODULE$, $ACTION$ and $RECORD$ variables in the LinkURL, will be replaced with the values set through DetailView.php The $MODULE$, $ACTION$, $CATEGORY$ variables in the LinkURL, will be replaced with the values set through ListView.php
Special LinkType¶
Following LinkTypes are treated specially while processing for display:
LinkType |
Description |
---|---|
HEADERSCRIPT |
The link will be treated as a javascript type and will be imported in the head section of the HTML output page as <script type=’text/javascript’ src=’linkurl’></script> |
HEADERCSS |
The link will be treated as a CSS type and will be imported in the head section of the HTML output page as <link rel=’stylesheet’ type=’text/css’ href=’linkurl> |
HEADERLINK |
You can see these link grouped under More on the top header panel. Useful if you want to provide utility tools like Bookmarklet etc. |