function _tmgmt_load_exports in Translation Management Tool 7
Fetches an array of exportables from files.
Parameters
$module: The module invoking this request. (Can be called by other modules.)
$directory: The subdirectory in the custom module.
$extension: The file extension.
$name: The name of the variable found in each file. Defaults to the same as $extension.
Return value
array Array of $name objects.
3 calls to _tmgmt_load_exports()
- TMGMTNodeSourceUIController::hook_views_default_views in sources/
node/ tmgmt_node.ui.inc - tmgmt_local_views_default_views in translators/
tmgmt_local/ tmgmt_local.module - Implements hook_default_views().
- tmgmt_ui_views_default_views in ui/
tmgmt_ui.module - Implements hook_views_default_views().
File
- ./
tmgmt.module, line 1447 - Main module file for the Translation Management module.
Code
function _tmgmt_load_exports($module, $directory, $extension, $name = NULL) {
if (!$name) {
$name = $extension;
}
$return = array();
// Find all the files in the directory with the correct extension.
$files = file_scan_directory(drupal_get_path('module', $module) . "/{$directory}", "/\\.{$extension}\$/");
foreach ($files as $path => $file) {
require DRUPAL_ROOT . '/' . $path;
if (isset($name)) {
$return[${$name}->name] = ${$name};
}
}
return $return;
}