function tripal_load_include_downloader_class
3.x tripal.fields.api.inc | tripal_load_include_downloader_class($class) |
Loads the TripalEntityDownloader file into scope.
Parameters
$class: The name of the class to include.
Return value
TRUE if the downloader class file was found, FALSE otherwise.
Related topics
8 calls to tripal_load_include_downloader_class()
- TripalEntityCollection::delete in tripal/
includes/ TripalEntityCollection.inc - Deletes the current collection
- TripalEntityCollection::getOutfile in tripal/
includes/ TripalEntityCollection.inc - Retrieves the output filename for the desired formatter.
- TripalEntityCollection::getOutfilePath in tripal/
includes/ TripalEntityCollection.inc - Retrieves the path for the downloadable file.
- TripalEntityCollection::write in tripal/
includes/ TripalEntityCollection.inc - Writes the collection to a file using a given formatter.
- tripal_get_field_field_formatters in tripal/
api/ tripal.fields.api.inc - Retrieves a list of field formatters compatible with a given field.
File
- tripal/
api/ tripal.fields.api.inc, line 383 - Provides an application programming interface (API) for working with fields attached to TripalEntity content types (bundles).
Code
function tripal_load_include_downloader_class($class) {
$modules = module_list(TRUE);
foreach ($modules as $module) {
$file_path = realpath(".") . '/' . drupal_get_path('module', $module) . '/includes/TripalFieldDownloaders/' . $class . '.inc';
if (file_exists($file_path)) {
module_load_include('inc', $module, 'includes/TripalFieldDownloaders/' . $class);
if (class_exists($class)) {
return TRUE;
}
}
}
// If the libraries module is enabled then we want to look for a
// TripalFieldDownloader library folder and see if our field exist there.
if (module_exists('libraries')) {
$library_path = libraries_get_path('TripalFieldDownloaders');
$file_path = realpath(".") . '/' . $library_path . '/' . $class . '.inc';
if (file_exists($file_path)) {
require_once ($file_path);
if (class_exists($class)) {
return TRUE;
}
}
}
return FALSE;
}