You are here

function admin_get_admin_blocks in Admin 7.2

Same name and namespace in other branches
  1. 6.2 admin.module \admin_get_admin_blocks()

Get blocks enabled for the admin toolbar.

2 calls to admin_get_admin_blocks()
admin_page_build in ./admin.module
Preprocessor that runs *before* template_preprocess_page().
admin_preprocess_html in ./admin.module
Implements hook_preprocess_html().

File

./admin.module, line 332

Code

function admin_get_admin_blocks() {
  $blocks = array();
  if (user_access('use admin toolbar') && ($enabled_blocks = admin_get_settings('blocks'))) {
    module_load_include('module', 'block', 'block');
    foreach ($enabled_blocks as $bid => $cache) {
      $block = NULL;
      $split = explode('-', $bid, 2);
      if (count($split) === 2) {
        list($module, $delta) = $split;
        $block = new stdClass();
        $block->module = $module;
        $block->delta = $delta;
        $block->bid = $bid;
        $block->title = NULL;
        $block->cache = is_numeric($cache) ? $cache : DRUPAL_NO_CACHE;
        $block->region = 'admin_toolbar';

        // Fake the block region.
        $blocks[$bid] = $block;
      }
    }
    $blocks = _block_render_blocks($blocks);
  }
  return $blocks;
}