function tripal_load_include_field_class
3.x tripal.fields.api.inc | tripal_load_include_field_class($class) |
Loads the TripalField class file into scope.
Parameters
$class: The class to include. This can be a TripalField, TripalFieldWidget or TripalFieldFormatter class name.
Return value
TRUE if the field type class file was found, FALSE otherwise.
Related topics
23 calls to tripal_load_include_field_class()
- theme_tripal_field_default in tripal/
includes/ tripal.fields.inc - Theme function for all TripalFieldWidget objects.
- TripalContentService_v0_1::getFieldFilters in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Gets any filter by statements provided by the user.
- TripalContentService_v0_1::getOrderBy in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Gets any order by statements provided by the user.
- TripalFieldDownloader::isFieldSupported in tripal/
includes/ TripalFieldDownloaders/ TripalFieldDownloader.inc - Inidcates if a given field is supported by this Downloader class.
- tripal_chado_field_storage_load in tripal_chado/
includes/ tripal_chado.field_storage.inc - Implements hook_field_storage_load().
File
- tripal/
api/ tripal.fields.api.inc, line 341 - Provides an application programming interface (API) for working with fields attached to TripalEntity content types (bundles).
Code
function tripal_load_include_field_class($class) {
$modules = module_list(TRUE);
foreach ($modules as $module) {
$field_type = preg_replace('/(^.*)_(formatter|widget)/', '$1', $class);
$file_path = realpath(".") . '/' . drupal_get_path('module', $module) . '/includes/TripalFields/' . $field_type . '/' . $class . '.inc';
if (file_exists($file_path)) {
module_load_include('inc', $module, 'includes/TripalFields/' . $field_type . '/' . $class);
if (class_exists($class)) {
return TRUE;
}
}
}
// If the libraries module is enabled then we want to look for a TripalFields
// library folder and see if our field exist there.
if (module_exists('libraries')) {
$library_path = libraries_get_path('TripalFields');
$field_type = preg_replace('/(^.*)_(formatter|widget)/', '$1', $class);
$file_path = realpath(".") . '/' . $library_path . '/' . $field_type . '/' . $class . '.inc';
if (file_exists($file_path)) {
require_once ($file_path);
if (class_exists($class)) {
return TRUE;
}
}
}
return FALSE;
}