function _potx_component_list in Translation template extractor 6.3
Same name and namespace in other branches
- 6.2 potx.module \_potx_component_list()
- 7.3 potx.admin.inc \_potx_component_list()
- 7 potx.module \_potx_component_list()
- 7.2 potx.admin.inc \_potx_component_list()
Generate a hierarchical structured list of components.
Return value
array Array in the directory structure identified.
- 'normal' keyed elements being subfolders
- '#name' elements being component objects for the 'name' component
- '#-count' being the file count of all components in the directory
1 call to _potx_component_list()
- potx_select_component_form in ./
potx.admin.inc - Component selection interface.
File
- ./
potx.admin.inc, line 249 - Administrative interface for the module.
Code
function _potx_component_list() {
$components = array();
// Get a list of all enabled modules and themes.
$result = db_query("SELECT name, filename, type, status FROM {system} WHERE type IN ('module', 'theme') ORDER BY filename ASC");
while ($component = db_fetch_object($result)) {
// Build directory tree structure.
$path_parts = explode('/', dirname($component->filename));
$dir =& $components;
foreach ($path_parts as $dirname) {
if (!isset($dir[$dirname])) {
$dir[$dirname] = array();
}
$dir =& $dir[$dirname];
}
// Information about components in this directory.
$component->basename = basename($component->filename);
$dir['#' . $component->basename] = $component;
$dir['#-count'] = isset($dir['#-count']) ? $dir['#-count'] + 1 : 1;
}
return $components;
}