You are here

function similarterms_get_active_block_vocabularies in Similar By Terms 6

Same name and namespace in other branches
  1. 7 similarterms.module \similarterms_get_active_block_vocabularies()

This function returns a list of all blocks for similarterms

Note: I could not find a public function in the block module to do this so I wrote this function based on _block_rehash(). If there's a better way to do this, this code should be refactored

1 call to similarterms_get_active_block_vocabularies()
similarterms_form_alter in ./similarterms.module
Implementation of hook_form_alter().

File

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

Code

function similarterms_get_active_block_vocabularies() {

  // TODO: add in code to check for blockcache module
  global $theme_key;
  init_theme();
  $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND module = '%s'", $theme_key, 'similarterms');
  while ($object = db_fetch_object($result)) {
    if ($object->status) {
      $blocks[$object->delta] = 1;
    }
  }
  return $blocks;
}