summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/dashboard/dashboard.info1
-rw-r--r--modules/dashboard/dashboard.module26
2 files changed, 25 insertions, 2 deletions
diff --git a/modules/dashboard/dashboard.info b/modules/dashboard/dashboard.info
index 71004b415..5ad675d12 100644
--- a/modules/dashboard/dashboard.info
+++ b/modules/dashboard/dashboard.info
@@ -5,5 +5,6 @@ core = 7.x
package = Core
version = VERSION
files[] = dashboard.module
+files[] = dashboard.test
dependencies[] = block
configure = admin/dashboard/customize
diff --git a/modules/dashboard/dashboard.module b/modules/dashboard/dashboard.module
index 76a7e2d26..b35e91d11 100644
--- a/modules/dashboard/dashboard.module
+++ b/modules/dashboard/dashboard.module
@@ -235,13 +235,35 @@ function dashboard_admin($launch_customize = FALSE) {
}
/**
- * Returns TRUE if the user is currently viewing the dashboard.
+ * 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
+ * TRUE if the dashboard should be visible on the current page, FALSE
+ * otherwise.
+ *
+ * @see dashboard_block_list_alter()
+ * @see dashboard_page_build()
*/
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';
+ $is_visible = isset($menu_item['page_callback']) && $menu_item['page_callback'] == 'dashboard_admin' && !empty($menu_item['access']);
}
return $is_visible;
}