You are here

function space_taxonomy::router in Spaces 6.3

Same name and namespace in other branches
  1. 7.3 spaces_taxonomy/plugins/space_taxonomy.inc \space_taxonomy::router()
  2. 7 spaces_taxonomy/plugins/space_taxonomy.inc \space_taxonomy::router()

Override of router().

Overrides space_type::router

File

spaces_taxonomy/plugins/space_taxonomy.inc, line 34

Class

space_taxonomy
Taxonomy integration for Spaces.

Code

function router($op, $object = NULL) {
  switch ($op) {
    case 'init':
      if (implode('/', array(
        arg(0),
        arg(1),
      )) === 'taxonomy/term' && arg(2)) {
        $terms = taxonomy_terms_parse_string(arg(2));
        if (!empty($terms['tids'])) {
          foreach ($terms['tids'] as $tid) {
            if ($term = taxonomy_get_term($tid)) {
              $this
                ->router_term($term);
            }
          }
        }
      }
      break;
    case 'node':
      $node = $object;
      if (!empty($node->taxonomy)) {
        foreach ($node->taxonomy as $term) {
          if ($term->vid == variable_get('spaces_taxonomy_vid', 0)) {
            $this
              ->router_term($term);
          }
        }
      }
      break;
  }
  return;
}