function token_replace($original, $type = 'global', $object = NULL, $leading = '[', $trailing = ']', $options = array()) {
  $full = token_get_values($type, $object, <b>FALSE</b>, $options);
  return _token_replace_tokens($original, $full->tokens, $full->values, $leading, $trailing);

In token_replace, token_get_values is called with flush set as FALSE. Could another argument be added to token_replace so that the user has control over the FLUSH?

I am batch parsing XML files to extract data. Then I use the token module to replace the tokens in an existing content type. If flush is set to FALSE, it replaces the tokens with data from the first file it read and ignores the data from the newer XML files.

I installed the development module and did some debugging. If flush is set to FALSE, it calls the hook_token_values() that I have implemented in the module only once. It does not call the hook for later token_replace().

Comments

derhasi’s picture

Status: Active » Closed (duplicate)

this issue is allready discussed in #262360: Expose control of token caching to functions that call token_replace. A solution might be approched by watching the $options or an an additional variable.