You are here

function spaces_core_taxonomy in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_core/spaces_core.module \spaces_core_taxonomy()

@TODO: Abstract this into a hook -- we will not always be testing against OG conditions!

Page call back to handle taxonomy listing

If a term is requested in a group context we use a group aware page when then term's vocabulary is related to any group targeted node types. If it is from a vocab that doesn't relate to any group aware content or is request outsite of a group contexts we use a group agnostic listing.

Parameters

$tid: The term id to generate a listing page for.

Return value

A themed taxonomy listing page.

1 string reference to 'spaces_core_taxonomy'
spaces_core_menu in spaces_core/spaces_core.module
Implementation of hook_menu().

File

spaces_core/spaces_core.module, line 249

Code

function spaces_core_taxonomy($tid) {
  if (is_numeric($tid) && ($t = taxonomy_get_term($tid))) {
    $v = taxonomy_get_vocabulary($t->vid);
  }
  if ($v && $t) {
    $view = views_get_view('spaces_taxonomy');
    $content = views_build_view('page', $view, array(
      $tid,
    ), true, 25);
    if (is_object($t) && is_object($v)) {
      drupal_set_title($v->name . ': ' . $t->name);

      // set taxonomy context
      context_set('taxonomy', array(
        'vid' => $t->vid,
        'tid' => $t->tid,
      ));
      if ($use_gid) {
        context_set('taxonomy', 'group_vocab', true);
      }
    }
    return $content;
  }
  return drupal_not_found();
  exit;
}