You are here

function ctools_block_content_type_content_types in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/content_types/block/block.inc \ctools_block_content_type_content_types()

Return all block content types available.

Modules wanting to make special adjustments the way that CTools handles their blocks can implement an extension to the hook_block() family, where the function name is of the form "$module . '_ctools_block_info'".

File

plugins/content_types/block/block.inc, line 42
Provide Drupal blocks as content.

Code

function ctools_block_content_type_content_types() {
  $types =& drupal_static(__FUNCTION__);
  if (isset($types)) {
    return $types;
  }
  $types = array();
  foreach (module_implements('block_info') as $module) {
    $module_blocks = module_invoke($module, 'block_info');
    if ($module_blocks) {
      foreach ($module_blocks as $delta => $block) {
        $info = _ctools_block_content_type_content_type($module, $delta, $block);

        // This check means modules can remove their blocks; particularly useful
        // if they offer the block some other way (like we do for views)
        if ($info) {
          $types["{$module}-{$delta}"] = $info;
        }
      }
    }
  }
  return $types;
}