You are here

function token_prepare_tokens in Token 6

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

A helper function to prepare raw tokens for replacement.

Parameters

$tokens: The array of tokens names with no delimiting characters.

$leading: String to prepend to the token. Default is TOKEN_PREFIX.

$trailing: String to append to the token. Default is TOKEN_SUFFIX.

Return value

An array of the formatted tokens.

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_multiple in ./token.module
Replace all tokens in a given string with appropriate values.

File

./token.module, line 459
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;
}