You are here

function finder_block in Finder 6

Implementation of hook_block().

See also

hook_block()

1 string reference to 'finder_block'
finder_i18nstrings_finderapi in modules/finder_i18nstrings/finder_i18nstrings.module
Implementation of hook_finderapi().

File

./finder.module, line 749
The finder module.

Code

function finder_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $finders = finder_load_multiple(NULL, array(
      'block' => 1,
    ));
    $blocks = array();
    foreach ($finders as $finder) {
      $blocks['finder_' . $finder->finder_id] = array(
        'info' => t('Finder') . ': ' . $finder->title,
        'cache' => BLOCK_NO_CACHE,
      );
    }
    return $blocks;
  }
  elseif ($op == 'view' && user_access('use finder')) {
    $finder_id = str_replace('finder_', '', $delta);
    $finder = finder_load($finder_id);
    if ($finder) {
      finder_invoke_finderapi($finder, 'finder_block');
      $block = array(
        'subject' => check_plain($finder->title),
        'content' => theme('finder_block', $finder),
      );
      return $block;
    }
  }
}