Closed (fixed)
Project:
Relation
Version:
7.x-1.0-beta1
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
23 Oct 2011 at 17:23 UTC
Updated:
1 Dec 2011 at 07:20 UTC
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
Comment #0.0
xcf33 commentedadded the ability to retrieve non-directional relation label
Comment #1
naught101 commentedSorry, I meant to deal with this ages ago, but forgot about it. Commited something similar in d971485. Thanks!
Comment #2.0
(not verified) commentedfunctional name