function _potx_module_list in Translation template extractor 5.2
Same name and namespace in other branches
- 5 potx.module \_potx_module_list()
- 6 potx.module \_potx_module_list()
Generate a hierarchical structured list of modules.
1 call to _potx_module_list()
- potx_select_form in ./
potx.module - Module selection interface.
File
- ./
potx.module, line 266 - Gettext translation template and translation extractor.
Code
function _potx_module_list() {
// Get current list of enabled modules and their file names.
$files = drupal_system_listing('\\.module$', 'modules', 'name', 0);
system_get_files_database($files, 'module');
ksort($files);
$modules = array();
foreach ($files as $file) {
// Skip disabled modules
if ($file->status != 1) {
continue;
}
// Build directory tree structure.
$path_parts = explode('/', dirname($file->filename));
$dir =& $modules;
foreach ($path_parts as $dirname) {
if (!isset($dir[$dirname])) {
$dir[$dirname] = array();
}
$dir =& $dir[$dirname];
}
// Information about modules in this directory.
$dir['#' . $file->basename] = $file;
$dir['.modulecount'] = isset($dir['.modulecount']) ? $dir['.modulecount'] + 1 : 1;
}
return $modules;
}