Forráskód Böngészése

Added new function to files API

Ficklin 10 éve
szülő
commit
fe5b20cc74
1 módosított fájl, 27 hozzáadás és 1 törlés
  1. 27 1
      tripal_core/api/tripal_core.files.api.inc

+ 27 - 1
tripal_core/api/tripal_core.files.api.inc

@@ -60,6 +60,8 @@ function tripal_create_files_dir($module_name, $path = FALSE) {
 }
 
 /**
+ * Retreives the Drupal relative directory for a Tripal module.
+ * 
  * Each Tripal module has a unique data directory which was created using the
  * tripal_create_files_dir function during installation.  This function
  * retrieves the directory path.
@@ -81,4 +83,28 @@ function tripal_get_files_dir($module_name = FALSE) {
   }
 
   return $data_dir;
-}
+}
+
+/**
+ * Retreives the Drupal stream (e.g. public://...) for a Tripal module.
+ * 
+ * Each Tripal module has a unique data directory which was created using the
+ * tripal_create_files_dir function during installation.  This function
+ * retrieves the directory path.
+ *
+ * @param $module_name
+ *   (Optional) The name of the module.
+ *
+ * @returns
+ *   The path within the Drupal installation where the data directory resides
+ *
+ * @ingroup tripal_files_api
+ */
+function tripal_get_files_stream($module_name = FALSE) {
+  $stream =  'public://tripal';
+  if ($module_name) {
+    $stream .= "/$module_name";
+  }
+  
+  return $stream;
+}