You are here

function boxes_block_info in Boxes 7

Same name and namespace in other branches
  1. 7.2 boxes.module \boxes_block_info()

Implements hook_block_info().

1 call to boxes_block_info()
boxes_create_hash in ./boxes.module
Create a hash for a block id.

File

./boxes.module, line 96
Core functionality for boxes module.

Code

function boxes_block_info() {
  ctools_include('plugins');
  $plugins = ctools_get_plugins('boxes', 'plugins');
  $boxes = boxes_box_load();
  $blocks = array();
  foreach ($boxes as $box) {
    $blocks[$box->delta]['info'] = $box->description;

    // Let context group the instances together
    $blocks[$box->delta]['context_group'] = t('Boxes for @plugin', array(
      '@plugin' => $plugins[$box->plugin_key]['title'],
    ));

    // Let each box determine how it is cached
    $blocks[$box->delta]['cache'] = $box
      ->cache_setting();
  }

  // 'Add' blocks for editing a page inline
  foreach ($plugins as $key => $info) {
    if (isset($info['title'])) {
      $blocks["boxes_add__{$key}"]['info'] = t('Add custom @title', array(
        '@title' => strtolower($info['title']),
      ));
      $blocks["boxes_add__{$key}"]['cache'] = DRUPAL_CACHE_CUSTOM;
    }
  }
  return $blocks;
}