You are here

function dashboard_admin_blocks in Drupal 7

Page callback: Builds the page for administering dashboard blocks.

This page reuses the Block module's administration form but limits editing to blocks that are available to appear on the dashboard.

See also

block_admin_display()

block_admin_display_form()

dashboard_form_dashboard_admin_display_form_alter()

template_preprocess_dashboard_admin_display_form()

1 string reference to 'dashboard_admin_blocks'
dashboard_menu in modules/dashboard/dashboard.module
Implements hook_menu().

File

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

Code

function dashboard_admin_blocks() {
  global $theme_key;
  drupal_theme_initialize();
  module_load_include('inc', 'block', 'block.admin');

  // Prepare the blocks for the current theme, and remove those that are
  // currently displayed in non-dashboard regions.
  // @todo This assumes the current page is being displayed using the same
  //   theme that the dashboard is displayed in.
  $blocks = block_admin_display_prepare_blocks($theme_key);
  $dashboard_regions = dashboard_region_descriptions();
  $regions_to_remove = array_diff_key(system_region_list($theme_key, REGIONS_VISIBLE), $dashboard_regions);
  foreach ($blocks as $id => $block) {
    if (isset($regions_to_remove[$block['region']])) {
      unset($blocks[$id]);
    }
  }

  // Pass in the above blocks and dashboard regions to the form, so that only
  // dashboard-related regions will be displayed.
  return drupal_get_form('dashboard_admin_display_form', $blocks, $theme_key, $dashboard_regions);
}