1 common.inc backdrop_parse_info_file($filename, $process_sections = FALSE)

Parses Backdrop module and theme .info files.

Info files are NOT for placing arbitrary theme and module-specific settings. Use config_get() and config_set() for managing settings.

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 machine names of modules required by this module.
  • package: The name of the package of modules this module belongs to.

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.
  • settings: Theme settings; e.g., settings[color] = true
  • stylesheets: Theme stylesheets; e.g., stylesheets[all][] = my-style.css.
  • scripts: Theme scripts; e.g., scripts[] = my-script.js.

See bartik.info for an example of a theme .info file.

Parameters

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

bool $process_sections: Flag indicating if sections should be parsed.

Return value

The info array.:

See also

backdrop_parse_info_format()

File

core/includes/common.inc, line 8522
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_parse_info_file($filename, $process_sections = FALSE) {
  $info = &backdrop_static(__FUNCTION__, array());

  if (!isset($info[$filename])) {
    if (!file_exists($filename)) {
      $info[$filename] = array();
    }
    else {
      $data = file_get_contents($filename);
      $info[$filename] = backdrop_parse_info_format($data, $process_sections);
    }
  }
  return $info[$filename];
}