summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaught1012011-11-17 07:10:47 (GMT)
committer naught1012011-11-17 07:10:47 (GMT)
commitd97148509733330c72f39dc8d65f0e4bdc8f632b (patch)
treef2a01dc3d43a57ce9008dcd9471ec73f805fac8d
parent42d2d693e3ea7f9c05c2edb0231d49ec3ab61c0c (diff)
Issue #1318856 by xcf33: add option to retrieve reverse type label.
-rw-r--r--relation.module11
1 files changed, 9 insertions, 2 deletions
diff --git a/relation.module b/relation.module
index 45fc6c1..af360cc 100644
--- a/relation.module
+++ b/relation.module
@@ -850,13 +850,20 @@ function relation_views_api() {
*
* @param $relation
* A relation object.
+ * @param $reverse
+ * optional: whether to get the reverse label (boolean).
*
* @return
* The label of the relation type.
*/
-function relation_get_type_label($relation) {
+function relation_get_type_label($relation, $reverse = FALSE) {
$type = relation_type_load($relation->relation_type);
- return $type->label;
+ if ($type->directional && $reverse) {
+ return $type->reverse_label;
+ }
+ else {
+ return $type->label;
+ }
}
/**