You are here

function patterns_array_map in Patterns 6.2

Same name and namespace in other branches
  1. 7.2 includes/unused.inc \patterns_array_map()
  2. 7 includes/unused.inc \patterns_array_map()

For use with token replacement

1 call to patterns_array_map()
patterns_get_pattern_details in ./patterns.module
Return an array with detailed information about the pattern

File

./patterns.module, line 1841
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_array_map($function, $array, $params) {
  $new_array = array();
  foreach ($array as $key => $value) {
    if (is_array($value)) {
      $new_array[$key] = patterns_array_map($function, $value, $params);
    }
    else {
      $params[] = $key;
      $key = call_user_func_array($function, $params);
      array_pop($params);
      $params[] = $value;
      $new_array[$key] = call_user_func_array($function, $params);
      array_pop($params);
    }
  }
  return $new_array;
}