function space_taxonomy::router in Spaces 7
Same name and namespace in other branches
- 6.3 spaces_taxonomy/plugins/space_taxonomy.inc \space_taxonomy::router()
- 7.3 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':
// NOTE: in D6 this used to handle multiple terms via taxonomy_terms_parse_string
// but in D7 that has gone away for taxonomy term pages
if (implode('/', array(
arg(0),
arg(1),
)) === 'taxonomy/term' && arg(2)) {
$tid = arg(2);
if ($term = taxonomy_term_load($tid)) {
$this
->router_term($term);
}
}
break;
case 'node':
$node = $object;
$vocab = variable_get('spaces_taxonomy_machine_name', 0);
$fields = field_info_fields();
foreach ($fields as $name => $field) {
if ($field['type'] == 'taxonomy_term_reference' && $vocab == $field['settings']['allowed_values'][0]['vocabulary']) {
$term = isset($node->{$name}['und'][0]['taxonomy_term']) ? $node->{$name}['und'][0]['taxonomy_term'] : taxonomy_term_load($node->{$name}['und'][0]['tid']);
if ($term) {
$this
->router_term($term);
return;
}
}
}
break;
}
return;
}