' . t('About') . ''; $output .= '
' . t('The Dashboard module provides a Dashboard page in the administrative interface for organizing administrative tasks and navigation, and tracking information within your site. The Dashboard page contains blocks, which you can add to and arrange using the drag and drop interface that appears when you click on the Customize dashboard link. For more information, see the online handbook entry for Dashboard module.', array('@handbook' => 'http://drupal.org/handbook/modules/dashboard', '@dashboard' => url('admin/dashboard'))) . '
'; $output .= '' . t('Rearrange blocks for display on the dashboard. Disabling a block makes it available on the main blocks administration page.', array('@dashboard-url' => url('admin/dashboard'), '@blocks-url' => url("admin/structure/block/list/{$GLOBALS['theme_key']}"))) . '
'; return $output; } } /** * Implements hook_menu(). */ function dashboard_menu() { $items['admin/structure/dashboard'] = array( 'title' => 'Dashboard', 'description' => 'Configure which blocks can be shown on the dashboard.', 'page callback' => 'dashboard_admin_blocks', 'access arguments' => array('administer blocks'), ); $items['admin/dashboard'] = array( 'title' => 'Dashboard', 'description' => 'View and customize your dashboard.', 'page callback' => 'dashboard_admin', 'access arguments' => array('access dashboard'), // Make this appear first, so for example, in admin menus, it shows up on // the top corner of the window as a convenient "home link". 'weight' => -15, ); $items['admin/dashboard/customize'] = array( 'title' => 'Customize dashboard', 'description' => 'Customize your dashboard.', 'page callback' => 'dashboard_admin', 'page arguments' => array(TRUE), 'access arguments' => array('access dashboard'), 'type' => MENU_VISIBLE_IN_BREADCRUMB, ); $items['admin/dashboard/drawer'] = array( 'page callback' => 'dashboard_show_disabled', 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, ); $items['admin/dashboard/block-content/%/%'] = array( 'page callback' => 'dashboard_show_block_content', 'page arguments' => array(3, 4), 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, ); $items['admin/dashboard/update'] = array( 'page callback' => 'dashboard_update', 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implements hook_permission(). */ function dashboard_permission() { return array( 'access dashboard' => array( 'title' => t('View the administrative dashboard'), 'description' => t('Customizing the dashboard requires the !permission-name permission.', array( '!permission-name' => l(t('Administer blocks'), 'admin/people/permissions', array('fragment' => 'module-block')), )), ), ); } /** * Implements hook_block_list_alter(). * * Skip rendering dashboard blocks when not on the dashboard page itself. This * prevents expensive dashboard blocks from causing performance issues on pages * where they will never be displayed. */ function dashboard_block_list_alter(&$blocks) { if (!dashboard_is_visible()) { foreach ($blocks as $key => $block) { if (in_array($block->region, dashboard_regions())) { unset($blocks[$key]); } } } } /** * Implements hook_page_build(). * * Display dashboard blocks in the main content region. */ function dashboard_page_build(&$page) { global $theme_key; if (dashboard_is_visible()) { $block_info = array(); // Create a wrapper for the dashboard itself, then insert each dashboard // region into it. $page['content']['dashboard'] = array('#theme_wrappers' => array('dashboard')); foreach (dashboard_regions() as $region) { // Insert regions even when they are empty, so that they will be // displayed when the dashboard is being configured. $page['content']['dashboard'][$region] = !empty($page[$region]) ? $page[$region] : array(); $page['content']['dashboard'][$region]['#dashboard_region'] = $region; // Allow each dashboard region to be themed differently, or fall back on // the generic theme wrapper function for dashboard regions. $page['content']['dashboard'][$region]['#theme_wrappers'][] = array($region, 'dashboard_region'); unset($page[$region]); $blocks_found = array(); foreach ($page['content']['dashboard'][$region] as $item) { if (isset($item['#theme_wrappers']) && is_array($item['#theme_wrappers']) && in_array('block', $item['#theme_wrappers'])) { // If this item is a block, ensure it has a subject. if (empty($item['#block']->subject)) { // Locally cache info data for the object for all blocks, in case // we find a block similarly missing title from the same module. if (!isset($block_info[$item['#block']->module])) { $block_info[$item['#block']->module] = module_invoke($item['#block']->module, 'block_info'); } $item['#block']->subject = $block_info[$item['#block']->module][$item['#block']->delta]['info']; } $blocks_found[$item['#block']->module . '_' . $item['#block']->delta] = TRUE; } } // Find blocks which were not yet displayed on the page (were empty), and // add placeholder items in their place for rendering. $block_list = db_select('block') ->condition('theme', $theme_key) ->condition('status', 1) ->condition('region', $region) ->fields('block') ->execute(); foreach ($block_list as $block) { if (!isset($blocks_found[$block->module . '_' . $block->delta])) { $block->enabled = $block->page_match = TRUE; $block->content = array('#markup' => '' . t('Drag and drop these blocks to the columns below. Changes are automatically saved. More options are available on the configuration page.', array('@dashboard-url' => url('admin/structure/dashboard'))) . '
'; $output .= '