You are here

function _patterns_replace_tokens in Patterns 7.2

Same name and namespace in other branches
  1. 5 patterns.module \_patterns_replace_tokens()
  2. 6.2 patterns.module \_patterns_replace_tokens()
  3. 6 patterns.module \_patterns_replace_tokens()
  4. 7 includes/core/token.inc \_patterns_replace_tokens()

Array walk callback to replace tokens inside form values.

1 call to _patterns_replace_tokens()
_patterns_recurse_tokens in includes/core/token.inc
Recurse an array and replace with tokens @TODO This is used instead of array_walk_recursive because of some strange issues with token_get_values failing.

File

includes/core/token.inc, line 27
Functions to related to token module. TODO: Check if we still need them

Code

function _patterns_replace_tokens(&$a, &$b, $identifiers = array()) {
  static $count = 0;

  // Replace IDs with identifiers from the current executing pattern
  if (preg_match('/@([a-zA-Z0-9_]+)@/', $a, $match)) {
    $a = str_replace($match[0], $identifiers[$match[1]], $a);
  }
  if (preg_match('/__([a-zA-Z0-9_]+)__/', $b, $match)) {
    $b = str_replace($match[0], $identifiers[$match[1]], $a);
  }

  // Replace tokens
  // Ste: was

  //$a = token_replace($a, 'global', NULL, '@', '@');

  //$b = token_replace($b, 'global', NULL, '__', '__');\

  //$a = token_replace($a, 'global', NULL, '@', '@');

  //$b = token_replace($b, 'global', NULL, '__', '__');
}