You are here

function _ccl_blocks_get_info in Custom Contextual Links 7

Same name and namespace in other branches
  1. 8 ccl_blocks/ccl_blocks.module \_ccl_blocks_get_info()

Helper function to retrieve all the information for all blocks in the system.

2 calls to _ccl_blocks_get_info()
ccl_blocks_ccl_link_info in ccl_blocks/ccl_blocks.module
Hook function to provide link option information for the link list page.
ccl_blocks_form_ccl_add_form_alter in ccl_blocks/ccl_blocks.module
Implements hook_form_FORM_ID_alter().

File

ccl_blocks/ccl_blocks.module, line 151
Implments support for CCL on blocks.

Code

function _ccl_blocks_get_info() {
  $block_info = cache_get('ccl_blocks_info');

  // If no data is found in the cache invoke all block hooks
  // and create the cache entry.
  if (empty($block_info)) {
    $block_info = array();
    foreach (module_implements('block_info') as $module) {
      $module_blocks = module_invoke($module, 'block_info');
      if (!empty($module_blocks)) {
        foreach ($module_blocks as $delta => $block) {
          $block = (object) $block;
          $block->module = $module;
          $block->delta = $delta;
          $block->bid = "{$block->module}|{$block->delta}";
          $block_info[$block->bid] = $block->info;
        }
      }
    }

    // Unset unsupported blocks.
    unset($block_info['system|main']);
    unset($block_info['system|help']);
    cache_set('ccl_blocks_info', $block_info);
  }
  if (isset($block_info->cid)) {
    return $block_info->data;
  }
  else {
    return $block_info;
  }
}