You are here

function admin_get_default_blocks in Admin 7.2

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

Get all blocks that have declared themselves visible in the admin toolbar by default.

3 calls to admin_get_default_blocks()
admin_get_settings in ./admin.module
Get variable settings or fallback to defaults.
admin_settings_form in ./admin.admin.inc
System settings form for admin toolbar.
theme_admin_settings_form in ./admin.admin.inc
Theme function for the admin settings form.

File

./admin.module, line 304

Code

function admin_get_default_blocks($reset = FALSE) {
  static $defaults;
  if (!isset($defaults) || $reset) {
    $cache = cache_get('admin_default_blocks');
    if ($cache && !$reset) {
      $defaults = $cache->data;
    }
    else {
      $defaults = array();
      foreach (module_implements('block_info') as $module) {
        $module_blocks = module_invoke($module, 'block_info');
        if ($module_blocks) {
          foreach ($module_blocks as $delta => $info) {
            if (isset($info['admin'])) {
              $defaults["{$module}-{$delta}"] = isset($info['cache']) ? $info['cache'] : DRUPAL_NO_CACHE;
            }
          }
        }
      }
      cache_set('admin_default_blocks', $defaults);
    }
  }
  return $defaults;
}