Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

token_prepare_tokens

Definition

token_prepare_tokens($tokens = array(), $leading = '[', $trailing = ']')
contributions/token/token.module, line 327

Description

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 chacaters

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.

Code

<?php
function token_prepare_tokens($tokens = array(), $leading = '[', $trailing = ']') {
  foreach ($tokens as $key => $value) {
    $tokens[$key] = $leading . $value . $trailing;
  }
  return $tokens;
}
?>