function _system_info_add_path
Prefixes all values in an .info file array with a given path.
This helper function is mainly used to prefix all array values of an .info file property with a single given path (to the module or theme); e.g., to prefix all values of the 'stylesheets' or 'scripts' properties with the file path to the defining module/theme.
Parameters
$info: A nested array of data of an .info file to be processed.
$path: A file path to prepend to each value in $info.
Return value
The $info array with prefixed values.
See also
2 calls to _system_info_add_path()
- _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.
File
-
modules/
system/ system.module, line 2688
Code
function _system_info_add_path($info, $path) {
foreach ($info as $key => $value) {
// Recurse into nested values until we reach the deepest level.
if (is_array($value)) {
$info[$key] = _system_info_add_path($info[$key], $path);
}
else {
unset($info[$key]);
$info[$value] = $path . '/' . $value;
}
}
return $info;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.