1 system.module _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

_system_rebuild_module_data()

_system_rebuild_theme_data()

File

core/modules/system/system.module, line 3124
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;
}