You are here

function theme_sna_blocks_taxonomy in Simple Node Archive Blocks 6

Same name and namespace in other branches
  1. 7 sna_blocks.module \theme_sna_blocks_taxonomy()

Returns a chronological archive block for node Vocabulary or Term.

1 theme call to theme_sna_blocks_taxonomy()
sna_blocks_block in ./sna_blocks.module
Implements of hook_block().

File

./sna_blocks.module, line 160
Provide a simple node archive block

Code

function theme_sna_blocks_taxonomy($variables) {
  $taxonomy_value = $variables['value'];
  $archive_items = $variables['archive_items'];
  $display_year = $variables['year'];
  $display_month = $variables['month'];
  $taxonomy_options = variable_get('sna_blocks_taxonomy_options', array());
  if (empty($taxonomy_options)) {
    return t('No posts available');
  }
  $tids = array();

  // $taxonomy_value a concatenated string - V7 for Vocabilary or T7 for Term.
  // Get term ids for Vocabulary.
  if ($taxonomy_value[0] == 'V') {
    $taxonomy_value = substr($taxonomy_value, 1);
    $vocabilary_id = $taxonomy_value;
    $terms = taxonomy_get_tree($vocabilary_id);
    foreach ($terms as $term) {
      $tids[$term->tid] = $term->tid;
    }
  }
  elseif ($taxonomy_value[0] == 'T') {
    $taxonomy_value = substr($taxonomy_value, 1);
    $tids[$taxonomy_value] = $taxonomy_value;
  }
  $results = _sna_blocks_resultset($tids, 'terms');
  $html = _sna_blocks_archivehtml($results, $archive_items, $display_year, $display_month, $tids, 'terms');
  return $html;
}