function dashboard_is_visible

dashboard_is_visible()

Determines if the dashboard should be displayed on the current page.

This function checks if the user is currently viewing the dashboard and has access to see it. It is used by other functions in the dashboard module to decide whether or not the dashboard content should be displayed to the current user.

Although the menu system normally handles the above tasks, it only does so for the main page content. However, the dashboard is not part of the main page content, but rather is displayed in special regions of the page (so it can interface with the Block module's method of managing page regions). We therefore need to maintain this separate function to check the menu item for us.

Return value

TRUE if the dashboard should be visible on the current page, FALSE otherwise.

See also

dashboard_block_list_alter()

dashboard_page_build()

File

modules/dashboard/dashboard.module, line 448
Provides a dashboard page in the administrative interface.

Code

function dashboard_is_visible() {
  static $is_visible;
  if (!isset($is_visible)) {
    // If the current menu item represents the page on which we want to display
    // the dashboard, and if the current user has access to see it, return
    // TRUE.
    $menu_item = menu_get_item();
    $is_visible = isset($menu_item['page_callback']) && $menu_item['page_callback'] == 'dashboard_admin' && !empty($menu_item['access']);
  }
  return $is_visible;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!dashboard!dashboard.module/function/dashboard_is_visible/7.x