All pastes #501624 Raw Edit

Something

public text v1 · immutable
·published 2007-05-22 04:15 UTC
rendered paste body
function cromods_term_path($term) {
  // In case I decide to do this for other vocabs as well...
  $vocabulary = taxonomy_get_vocabulary($term->vid);
  if ($vocabulary->name == 'communities') {
    // The alias will always be communities/term-name
    $alias = "communities/" . $term->name;
    
    // Find the real path for the alias, if one exists
    $path = drupal_lookup_path("source", $alias)
    if (!$path) {
      // No such alias, so the node hasn't been created for that community, so just use the default
      $path = 'taxonomy/term/'. $term->tid; 
    }
  }
  return $path;
}