function tripal_get_importers
3.x tripal.importer.api.inc | tripal_get_importers() |
Retrieves a list of TripalImporter Importers.
The TripalImporter classes can be added by a site developer that wishes to create a new data loader. The class file should be placed in the [module]/includes/TripalImporter directory. Tripal will support any loader as long as it is in this directory and extends the TripalImporter class.
Return value
A list of TripalImporter names.
Related topics
1 call to tripal_get_importers()
- tripal_menu in tripal/
tripal.module - Implements hook_menu(). Defines all menu items needed by Tripal Core
File
- tripal/
api/ tripal.importer.api.inc, line 54 - Provides an application programming interface (API) for working with data file importers using the TripalImporter class.
Code
function tripal_get_importers() {
$importers = array();
$modules = module_list(TRUE);
foreach ($modules as $module) {
// Find all of the files in the tripal_chado/includes/fields directory.
$loader_path = drupal_get_path('module', $module) . '/includes/TripalImporter';
$loader_files = file_scan_directory($loader_path, '/.inc$/');
// Iterate through the fields, include the file and run the info function.
foreach ($loader_files as $file) {
$class = $file->name;
module_load_include('inc', $module, 'includes/TripalImporter/' . $class);
if (class_exists($class) and is_subclass_of($class, 'TripalImporter')) {
$importers[] = $class;
}
}
}
return $importers;
}