There is currently a function that retrieves he relation label

function relation_get_type_label($relation) {
  $type = relation_type_load($relation->relation_type);
  return $type->label;
}

We can modify if easily and retrieve the reverse label as well

function relation_get_type_label($relation, $reverse = FALSE) {
  $type = relation_type_load($relation->relation_type);
  
  if ($type->directional == 0) {
     return $type->label; 
  } 
  else {
    return (!$reverse) ? $type->label : $type->reverse_label; 
  }
}

Comments

xcf33’s picture

Issue summary: View changes

added the ability to retrieve non-directional relation label

naught101’s picture

Status: Active » Fixed

Sorry, I meant to deal with this ages ago, but forgot about it. Commited something similar in d971485. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

functional name