function _potx_component_list in Translation template extractor 7
Same name and namespace in other branches
- 6.3 potx.admin.inc \_potx_component_list()
- 6.2 potx.module \_potx_component_list()
- 7.3 potx.admin.inc \_potx_component_list()
- 7.2 potx.admin.inc \_potx_component_list()
Generate a hierarchical structured list of components.
Return value
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_form in ./
potx.module - Component selection interface.
File
- ./
potx.module, line 278 - Gettext translation template and translation extractor.
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");
foreach ($result as $component) {
// 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;
}