You are here

function spaces_dashboard_get_module in Spaces 6.3

Same name and namespace in other branches
  1. 7.3 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_get_module()
  2. 7 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_get_module()

Retrieve the module that a block conceptually belongs to. Will detect the feature that provides block X as a default block if using Views, Panels or other block-providing modules.

2 calls to spaces_dashboard_get_module()
spaces_dashboard_admin_form in spaces_dashboard/spaces_dashboard.admin.inc
Provide a form that allows administrators to select which blcoks are available in which dashboards.
spaces_dashboard_preprocess_context_block_browser in spaces_dashboard/spaces_dashboard.module
Preprocessor for theme('context_block_browser').

File

spaces_dashboard/spaces_dashboard.module, line 381

Code

function spaces_dashboard_get_module($block) {
  $map = features_get_component_map();
  switch ($block->module) {
    case 'views':
      $delta = $block->delta;

      // if this is 32, this should be an md5 hash.
      if (strlen($delta) == 32) {
        $hashes = variable_get('views_block_hashes', array());
        if (!empty($hashes[$delta])) {
          $delta = $hashes[$delta];
        }
      }
      list($name, $display_id) = explode('-', $delta);
      return !empty($map['views'][$name]) ? reset($map['views'][$name]) : 'views';
    case 'panels_mini':
      return isset($map['panels_mini'][$block->delta]) ? $map['panels_mini'][$block->delta] : 'panels_mini';
    default:
      return $block->module;
  }
}