You are here

function token_prepare_tokens in Token 5

Same name and namespace in other branches
  1. 6 token.module \token_prepare_tokens()

A helper function that transforms all the elements of an array. Used to change the delimiter style from brackets to percent symbols etc.

Parameters

tokens: The array of tokens keys with no delimiting characters

leading: Character(s) to prepend to the token key before searching for matches. Defaults to an open-bracket.

trailing: Character(s) to append to the token key before searching for matches. Defaults to a close-bracket. @return The array of token keys, each wrapped in the specified delimiter style.

2 calls to token_prepare_tokens()
token_get_invalid_tokens_by_context in ./token.module
Validate an tokens in raw text based on possible contexts.
_token_replace_tokens in ./token.module

File

./token.module, line 412
The Token API module.

Code

function token_prepare_tokens($tokens = array(), $leading = TOKEN_PREFIX, $trailing = TOKEN_SUFFIX) {
  foreach ($tokens as $key => $value) {
    $tokens[$key] = $leading . $value . $trailing;
  }
  return $tokens;
}