Sfoglia il codice sorgente

Bulk Loader: Fixed setting of node title based on loader_name

Lacey Sanderson 11 anni fa
parent
commit
c87484793f

+ 16 - 1
tripal_bulk_loader/includes/tripal_bulk_loader.chado_node.inc

@@ -211,6 +211,22 @@ function tripal_bulk_loader_load($nodes) {
 
 }
 
+/**
+ * Implements hook_node_presave()
+ * @ingroup tripal_bulk_loader
+ */
+function tripal_bulk_loader_node_presave($node) {
+
+  // We need to set the title using loader details before the node is saved
+  // which has already been done by the time hook_insert is called
+  switch ($node->type) {
+    case 'tripal_bulk_loader':
+      $node->title = 'Bulk Loading Job: ' . $node->loader_name;
+      break;
+  }
+}
+
+
 /**
  * Implements node_insert
  * Insert the data from the node form on Create content
@@ -220,7 +236,6 @@ function tripal_bulk_loader_load($nodes) {
  */
 function tripal_bulk_loader_insert($node) {
 
-  $node->title = $node->loader_name;
   db_insert('tripal_bulk_loader')->fields(array(
     'nid' => $node->nid,
     'loader_name' => $node->loader_name,