drupal_parse_info_file

Versions
6 – 7
drupal_parse_info_file($filename)

Parse Drupal module and theme info file format.

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 also

forum.info

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: engine = phptemplate
  • base: Name of a base theme, if applicable, eg: base = zen
  • regions: Listed regions eg: region[left] = Left sidebar
  • features: Features available eg: features[] = logo
  • stylesheets: Theme stylesheets eg: stylesheets[all][] = my-style.css
  • scripts: Theme scripts eg: scripts[] = my-script.css

See also

garland.info

See also

drupal_parse_info_format()

Parameters

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

Return value

The info array.

▾ 7 functions call drupal_parse_info_file()

drupal_required_modules in includes/module.inc
Array of modules required by core.
help_page in modules/help/help.admin.inc
Menu callback; prints a page listing general help for a module.
install_profile_info in includes/install.inc
Retrieve info about an install profile from its .info file.
system_modules_uninstall_confirm_form in modules/system/system.admin.inc
Confirm uninstall of selected modules.
update_fix_d7_install_profile in includes/update.inc
Register the currently installed profile in the system table.
_system_rebuild_module_data in modules/system/system.module
Helper function to scan and collect module .info data.
_system_rebuild_theme_data in modules/system/system.module
Helper function to scan and collect theme .info data and their engines.

Code

includes/common.inc, line 5866

<?php
function drupal_parse_info_file($filename) {
  if (!file_exists($filename)) {
    return array();
  }

  $data = file_get_contents($filename);
  return drupal_parse_info_format($data);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.