Skip to content

Instantly share code, notes, and snippets.

@pgorod
Forked from jmertic/gist:3684156
Last active February 12, 2024 19:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgorod/5de7c6f8d37413654b16e06668d7e1b1 to your computer and use it in GitHub Desktop.
Save pgorod/5de7c6f8d37413654b16e06668d7e1b1 to your computer and use it in GitHub Desktop.
HOWTO: Adding your own ListView action items - Part 1
<?php
require_once('include/MVC/View/views/view.list.php');
class CustomAccountsViewList extends ViewList
{
/**
* @see ViewList::preDisplay()
*/
public function preDisplay()
{
parent::preDisplay();
$this->lv->actionsMenuExtraItems[] = $this->buildMyMenuItem();
}
/**
* @return string HTML
*/
protected function buildMyMenuItem()
{
global $app_strings;
return <<<EOHTML
<a class="menuItem" style="width: 150px;" href="#" onmouseover='hiliteItem(this,"yes");'
onmouseout='unhiliteItem(this);'
onclick="sugarListView.get_checks();
if(sugarListView.get_checks_count() &lt; 1) {
alert('{$app_strings['LBL_LISTVIEW_NO_SELECTED']}');
return false;
}
document.MassUpdate.action.value='displaypassedids';
document.MassUpdate.submit();">Send records to a new view!</a>
EOHTML;
}
}
@pgorod
Copy link
Author

pgorod commented Oct 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment