Browse Source

Moved code to retrieve nodes of type 'Blast Database' into a separate function, get_blast_database_nodes()

E.Cannon 7 years ago
parent
commit
bf5a473a5e
1 changed files with 22 additions and 17 deletions
  1. 22 17
      api/blast_ui.api.inc

+ 22 - 17
api/blast_ui.api.inc

@@ -47,24 +47,9 @@ function get_blast_database($identifiers) {
  */
 function get_blast_database_options($type) {
   global $user;
-
-  // Use the Entity API to get a list of BLAST Nodes to load
-  // We use this function in order respect node access control so that
-  // administrators can use this module in combination with a node access module
-  // of their choice to limit access to specific BLAST databases.
-  $query = new EntityFieldQuery();
-  $query->entityCondition('entity_type', 'node')
-    // Restrict to BLASTDB nodes.
-    ->entityCondition('bundle', 'blastdb')
-    // Restrict to Published nodes.
-    ->propertyCondition('status', 1)
-    // Restrict to nodes the current user has permission to view.
-    ->addTag('node_access');
-  $entities = $query->execute();
-
-
+  
   // Get all BlastDB nodes
-  $nodes  = node_load_multiple(array_keys($entities['node']));
+  $nodes = get_blast_database_nodes(); 
 
   // Support obsolete database type n/p
   $obs_type = '';
@@ -90,6 +75,26 @@ function get_blast_database_options($type) {
   return $options;
 }
 
+function get_blast_database_nodes() {
+  // Use the Entity API to get a list of BLAST Nodes to load
+  // We use this function in order respect node access control so that
+  // administrators can use this module in combination with a node access module
+  // of their choice to limit access to specific BLAST databases.
+  $query = new EntityFieldQuery();
+  $query->entityCondition('entity_type', 'node')
+    // Restrict to BLASTDB nodes.
+    ->entityCondition('bundle', 'blastdb')
+    // Restrict to Published nodes.
+    ->propertyCondition('status', 1)
+    // Restrict to nodes the current user has permission to view.
+    ->addTag('node_access');
+  $entities = $query->execute();
+
+  // Get all BlastDB nodes
+  return node_load_multiple(array_keys($entities['node']));
+}
+
+
 /**
  * Retrieve all the information for a blast job in a standardized node-like format.
  *