You are here

function similarterms_block_list in Similar By Terms 6

Perform the "list" op for hook_block().

Return value

Array of block definition.

1 call to similarterms_block_list()
similarterms_block in ./similarterms.module
Implementation of hook_block().

File

./similarterms.module, line 63
Similar By Terms module displays a block with similar content based on taxonomy terms.

Code

function similarterms_block_list() {
  $blocks[0]['info'] = t('Similar entries from ANY vocabulary.');
  $blocks[0]['cache'] = BLOCK_CACHE_PER_PAGE;
  if (variable_get("similarterms_vocabularies", 'multi_select_and_tags') == 'all') {
    foreach (taxonomy_get_vocabularies() as $v) {
      $blocks[$v->vid]['info'] = t('Similar entries from the @vocab vocabulary.', array(
        '@vocab' => $v->name,
      ));
      $blocks[$v->vid]['cache'] = BLOCK_CACHE_PER_PAGE;
    }
  }
  else {
    foreach (taxonomy_get_vocabularies() as $v) {

      // this only makes sense for multi-select vocabularies and free tagging
      if ($v->multiple || $v->tags) {
        $blocks[$v->vid]['info'] = t('Similar entries from the @vocab vocabulary.', array(
          '@vocab' => $v->name,
        ));
        $blocks[$v->vid]['cache'] = BLOCK_CACHE_PER_PAGE;
      }
    }
  }
  return $blocks;
}