You are here

function token_render_array in Token 7

Same name and namespace in other branches
  1. 8 token.module \token_render_array()

Do not use this function yet. Its API has not been finalized.

1 call to token_render_array()
token_tokens in ./token.tokens.inc
Implements hook_tokens().

File

./token.module, line 1163
Enhances the token API in core: adds a browseable UI, missing tokens, etc.

Code

function token_render_array(array $array, array $options = array()) {
  $rendered = array();
  foreach (element_children($array) as $key) {
    $value = $array[$key];
    $rendered[] = is_array($value) ? render($value) : (string) $value;
  }
  if (!empty($options['sanitize'])) {
    $rendered = array_map('check_plain', $rendered);
  }
  $join = isset($options['join']) ? $options['join'] : ', ';
  return implode($join, $rendered);
}