function system_get_info
7.x system.module | system_get_info($type, $name = NULL) |
Returns an array of information about enabled modules or themes.
This function returns the information from the {system} table corresponding to the cached contents of the .info file for each active module or theme.
Parameters
$type: Either 'module' or 'theme'.
$name: (optional) The name of a module or theme whose information shall be returned. If omitted, all records for the provided $type will be returned. If $name does not exist in the provided $type or is not enabled, an empty array will be returned.
Return value
An associative array of module or theme information keyed by name, or only information for $name, if given. If no records are available, an empty array is returned.
See also
10 calls to system_get_info()
- drupal_install_profile_distribution_name in drupal-7.x/
includes/ install.inc - Loads the installation profile, extracting its defined distribution name.
- field_help in drupal-7.x/
modules/ field/ field.module - Implements hook_help().
- help_page in drupal-7.x/
modules/ help/ help.admin.inc - Menu callback; prints a page listing general help for a module.
- ModuleRequiredTestCase::testDisableRequired in drupal-7.x/
modules/ system/ system.test - Assert that core required modules cannot be disabled.
- system_add_module_assets in drupal-7.x/
modules/ system/ system.module - Adds CSS and JavaScript files declared in module .info files.
File
- drupal-7.x/
modules/ system/ system.module, line 2338 - Configuration system that lets administrators modify the workings of the site.
Code
function system_get_info($type, $name = NULL) {
$info = array();
if ($type == 'module') {
$type = 'module_enabled';
}
$list = system_list($type);
foreach ($list as $shortname => $item) {
if (!empty($item->status)) {
$info[$shortname] = $item->info;
}
}
if (isset($name)) {
return isset($info[$name]) ? $info[$name] : array();
}
return $info;
}