function system_get_info

Returns an array of information about enabled modules or themes.

This function returns the contents of the .info file for each enabled 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

system_rebuild_module_data()

system_rebuild_theme_data()

12 calls to system_get_info()
drupal_install_profile_distribution_name in drupal/core/includes/install.inc
Loads the installation profile, extracting its defined distribution name.
field_help in drupal/core/modules/field/field.module
Implements hook_help().
help_page in drupal/core/modules/help/help.admin.inc
Page callback: Prints a page listing general help for a module.
InfoAlterTest::testSystemInfoAlter in drupal/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php
Tests that theme .info data is rebuild after enabling a module.
layout_page_list in drupal/core/modules/layout/layout.admin.inc
Page callback: Presents a list of layouts.

... See full list

File

drupal/core/modules/system/system.module, line 2685
Configuration system that lets administrators modify the workings of the site.

Code

function system_get_info($type, $name = NULL) {
  $info = array();
  if ($type == 'module') {
    $data = system_rebuild_module_data();
    foreach (module_list() as $module) {
      $info[$module] = $data[$module]->info;
    }
  }
  else {
    $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;
}