You are here

function facetapi_block_info in Facet API 6

Same name and namespace in other branches
  1. 6.3 facetapi.block.inc \facetapi_block_info()
  2. 7.2 facetapi.block.inc \facetapi_block_info()
  3. 7 facetapi.block.inc \facetapi_block_info()

Returns data for the "list" operation of hook_block().

Return value

An array of block information.

1 call to facetapi_block_info()
facetapi_block in ./facetapi.module
Implementation of hook_block().

File

./facetapi.widget.inc, line 170
Widget callbacks and building functions.

Code

function facetapi_block_info() {
  $blocks = array();

  // Gets "delta map", iterates over available searcher modules.
  $map = facetapi_delta_map_get();
  foreach (facetapi_adapter_info_get() as $searcher => $definition) {
    $facets = facetapi_enabled_facets_get($searcher, 'block');
    foreach ($facets as $facet_name => $facet) {

      // Gets the delta from the delta map.
      $string = $searcher . ':block:' . $facet_name;
      $delta = array_search($string, $map);

      // Defines the block.
      // @todo explore more efficient caching options.
      $blocks[$delta] = array(
        'info' => sprintf('Facet API: %s: %s', $searcher, $facet_name),
        'cache' => BLOCK_NO_CACHE,
      );
    }
  }

  // Returns available blocks.
  return $blocks;
}