function drupal_parse_info_file

cis7 drupal_parse_info_file($filename)
cle7 drupal_parse_info_file($filename)
elmsmedia7 drupal_parse_info_file($filename)
icor7 drupal_parse_info_file($filename)
meedjum_blog7 drupal_parse_info_file($filename)
mooc7 drupal_parse_info_file($filename)

Parses Drupal module and theme .info files.

Info files are NOT for placing arbitrary theme and module-specific settings. Use variable_get() and variable_set() for that.

Information stored in a module .info file:

  • name: The real name of the module for display purposes.
  • description: A brief description of the module.
  • dependencies: An array of shortnames of other modules this module requires.
  • package: The name of the package of modules this module belongs to.

See for an example of a module .info file.

Information stored in a theme .info file:

  • name: The real name of the theme for display purposes.
  • description: Brief description.
  • screenshot: Path to screenshot relative to the theme's .info file.
  • engine: Theme engine; typically phptemplate.
  • base: Name of a base theme, if applicable; e.g., base = zen.
  • regions: Listed regions; e.g., region[left] = Left sidebar.
  • features: Features available; e.g., features[] = logo.
  • stylesheets: Theme stylesheets; e.g., stylesheets[all][] = my-style.css.
  • scripts: Theme scripts; e.g., scripts[] = my-script.js.

See for an example of a theme .info file.


$filename: The file we are parsing. Accepts file with relative or absolute path.

Return value

The info array.

See also


14 calls to drupal_parse_info_file()
admin_menu_links_icon in sites/all/modules/ulmus/admin_menu/
Build icon menu links; mostly containing maintenance helpers.
backup_migrate_destination::load_files_info in sites/all/modules/ulmus/backup_migrate/includes/
Load up the file's metadata from the accompanying .info file if applicable.
ctools_plugin_process_info in sites/all/modules/ulmus/ctools/includes/
Process an info file for plugin information, rather than a hook.
drupal_required_modules in includes/
Returns an array of modules required by core.
drupal_system_listing in includes/
Returns information about system object files (modules, themes, etc.).

... See full list


includes/, line 7270
Common functions that many Drupal modules will need to reference.


function drupal_parse_info_file($filename) {
  $info = &drupal_static(__FUNCTION__, array());

  if (!isset($info[$filename])) {
    if (!file_exists($filename)) {
      $info[$filename] = array();
    else {
      $data = file_get_contents($filename);
      $info[$filename] = drupal_parse_info_format($data);
  return $info[$filename];