diff --git a/project.module b/project.module
index 72d30e5..301a57d 100644
--- a/project.module
+++ b/project.module
@@ -397,3 +397,71 @@ function project_maintainer_project_load($nid) {
 
   return $maintainers;
 }
+
+
+/**
+ * Get an array of projects for use in select form elements.
+ *
+ * The keys are the project nid, and the values are the project names. The
+ * array will be sorted into the proper catagories with headers for each term,
+ * based the node types of the projects.
+ *
+ * @param $project_machine_names
+ *   Reference to be filled with an array of project machine name => id mappings. This
+ *   array is used by the project_issue and project_release search form code.
+ * @param $issues
+ *   If TRUE, only projects with issue tracking  enabled are returned.
+ *   For this option to do much good, the project_issue module should be
+ *   enabled.
+ * @param $key_prefix
+ *   Prefix to prepend to all keys in the returned array. @TODO is this ever used ?
+ * @param string $include_sandbox
+ *   Should sandboxes be included in the listing? Can be either 'no_sandboxes'
+ *   (exclude sandboxes from the list, the default), 'include_sandboxes'
+ *   (include sandboxes) , 'only_sandboxes' (only show sandboxes).
+ */
+function project_projects_select_options(&$project_machine_names, $issues = TRUE, $key_prefix = NULL, $include_sandbox = 'no_sandboxes') {
+  $projects = array();
+
+  $project_entity_types = project_project_entity_bundles();
+  if (empty($project_entity_types)) {
+    // If there are no project entity types, just return the empty array here.
+    return $projects;
+  }
+
+  $query = new EntityFieldQuery();
+  $query->entityCondition('entity_type', PROJECT_ENTITY_TYPE, '=');
+  
+  if ($issues && module_exists('project_issue')) {
+    $query->fieldCondition('field_project_has_issue_queue', 'value', '1', '=');
+  }
+
+  switch ($include_sandbox) {
+    case 'no_sandboxes':
+      $query->fieldCondition('field_project_type', 'value', 'full', '=');
+      break;
+
+    case 'only_sandboxes':
+      $query->fieldCondition('field_project_type', 'value', 'sandbox', '=');
+      break;
+
+    case 'include_sandboxes':
+    default:
+      // Otherwise, ignore sandboxes entirely.
+      break;
+  }
+
+  $result = $query->execute();
+  foreach ($result as $entity_type => $project_entities) {
+    $project_entities = entity_load($entity_type, array_keys($project_entities));
+    foreach ($project_entities as $project) {
+      $project_entity_ids = entity_extract_ids(PROJECT_ENTITY_TYPE, $project);
+      $projects[$key_prefix . $project_entity_ids[0]] = $project->title;
+      if (is_array($project_machine_names)) {
+        $project_machine_names[$project->field_project_machine_name[LANGUAGE_NONE][0]['value']] = $project_entity_ids[0];
+      }
+    }
+  }
+  return $projects;
+}
+
