function _system_info_add_path
_system_info_add_path($info, $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
File
- modules/system/system.module, line 2658
- Configuration system that lets administrators modify the workings of the site.
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); } // Unset the original value's key and set the new value with prefix, using // the original value as key, so original values can still be looked up. else { unset($info[$key]); $info[$value] = $path . '/' . $value; } } return $info; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.module/function/_system_info_add_path/7.x