Parses Drupal module and theme .info.yml files.
Info files are NOT for placing arbitrary theme and module-specific settings. Use Config::get() and Config::set()->save() for that. Info files are formatted as YAML. If the 'version' key is set to 'VERSION' in any info file, then the value will be substituted with the current version of Drupal core.
Information stored in a module .info.yml file:
See forum.info.yml for an example of a module .info.yml file.
Information stored in a theme .info.yml file:
See bartik.info.yml for an example of a theme .info.yml file.
string $filename: The file we are parsing. Accepts file with relative or absolute path.
array The info array.
function drupal_parse_info_file($filename) {
$info =& drupal_static(__FUNCTION__, array());
if (!isset($info[$filename])) {
if (!file_exists($filename)) {
$info[$filename] = array();
}
else {
$parser = new Parser();
$info[$filename] = $parser
->parse(file_get_contents($filename));
if (isset($info[$filename]['version']) && $info[$filename]['version'] === 'VERSION') {
$info[$filename]['version'] = VERSION;
}
}
}
return $info[$filename];
}