You are here

function patterns_array_map in Patterns 7

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

For use with token replacement

1 call to patterns_array_map()
patterns_parser_get_pattern_details in includes/parser/parser.inc
Returns an array with detailed information about the pattern(s) referenced in the pattern files (included).

File

includes/unused.inc, line 295
Functions that are unused at the moment.

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;
}