Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Global events

Menu item: Modify

Scroll Prev Next More



ModifyMenuItem event is deprecated. Use ModifyMenu event.


The ModifyMenuItem event is executed for each menu item before the page is displayed in the browser. Use this event to modify or hide menu items.





a menu item object.

Return value

True: a menu item is shown.


False: a menu item is hidden.

Applies to pages

All pages with the Menu items.



gets the link type.

Note: The link types are: Internal (link to a page generated by PHPRunner, e.g. List, Print etc.), External (link to any external web page), None (if menu item is not a link: for example, a group or separator).



gets the URL of an external link.


sets the URL of the link and makes it external.


gets the parameters of an internal link.


sets the parameters of an internal link. These parameters may be also set on the Choose page screen using the '...' button next to the List page.

Note: The parameters are a part of the link. E.g., if the parameters are foo=bar&bar=foo, the link is ...list.php?foo=bar&bar=foo.



sets the title of the link.


gets the title of the link.


gets the table name that an internal link points to.


sets the table name.


gets the page type (List, Add, etc.).


sets the page type (List, Add, Search, Print, Report, Chart).

Example 1

Adding parameters to a menu item

if ($menuItem->getLinkType() == 'External')
  else if($menuItem->getLinkType() == 'Internal')
    if ($menuItem->getTable() == 'carsmake')
    return false;
  return true;

Example 2
Hide some menu items based on the group of the authorized user. If the menu item is a link to an internal application page, you can assign the table permissions.


However, if the menu item is an external link, you show/hide it directly in this event.



if ($_SESSION["GroupID"]!="manager")
  $title = $menuItem->getTitle();
  if ($title=="Yahoo Finance")
    return false;
return true;

Example 3

Display a record counter next to each menu item. The code checks if the menu item is an internal table or view and adds the number of records to the menu item title.


if($menuItem->getLinkType() == 'Internal')
global $tables_data;
$ps = new ProjectSettings($table);
$table= $ps->getOriginalTableName();
$rs=DB::Query("select count(*) as c from " . AddTableWrappers($table));
$data = $rs->fetchAssoc();
$menuItem->setTitle($menuItem->getTitle() . " (". $data["c"] . ")");
return true;

Example 4

Hide some menu items in the Mobile mode


  if ($menuItem->getTable() == 'Cars' && MobileDetected()) {
      return false;
  return true;

Recommended predefined actions and sample events:

Check to see if a specific record exists

See also:

Choose pages screen

Menu builder

Working with page elements

RunnerPage class: hideItem()

Datasource tables

Session keys

Save user data in session variables

Database API: Query()

Javascript API: toggleItem()

Events. Redirect to another page


Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software