Browse Source

Merge pull request #169 from statonlab/label_callback

Label callback
Stephen Ficklin 7 years ago
parent
commit
05fa442c0e
1 changed files with 16 additions and 0 deletions
  1. 16 0
      tripal/api/tripal.entities.api.inc

+ 16 - 0
tripal/api/tripal.entities.api.inc

@@ -1113,4 +1113,20 @@ function theme_token_list($tokens) {
   return theme('table', array('header' => $header, 'rows' => $rows));
 }
 
+/**
+ * Define the entity label callback.  This will return the title.
+ *
+ * @param $entity
+ *
+ * @return mixed
+ */
+
+function tripal_entity_label($entity) {
+  if (property_exists($entity, 'title')) {
+    return $entity->title;
+  }
+  return NULL;
+}
+
+