You are here

function block_ctools_block_info in Chaos Tool Suite (ctools) 7

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

File

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

Code

function block_ctools_block_info($module, $delta, &$info) {
  $info['icon'] = 'icon_core_block_empty.png';
  $info['category'] = t('Custom blocks');

  // The title of custom blocks from the block module is stored in the
  // {block} table. Look for it in the default theme as a reasonable
  // default value for the title.
  $block_info_cache =& drupal_static(__FUNCTION__);
  if (!isset($block_info_cache)) {
    $block_info_cache = db_select('block', 'b')
      ->fields('b')
      ->condition('b.module', 'block')
      ->condition('b.theme', variable_get('theme_default', 'bartik'))
      ->addTag('block_load')
      ->addTag('translatable')
      ->execute()
      ->fetchAllAssoc('delta');
  }
  if (isset($block_info_cache[$delta])) {
    $info['defaults'] = array(
      'override_title' => TRUE,
      'override_title_text' => $block_info_cache[$delta]->title,
    );
  }
}