You are here

function token_flatten_tree in Token 7

Flatten a token tree.

1 call to token_flatten_tree()
token_build_tree in ./token.module
Build a tree array of tokens used for themeing or information.

File

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

Code

function token_flatten_tree($tree) {
  $result = array();
  foreach ($tree as $token => $token_info) {
    $result[$token] = $token_info;
    if (isset($token_info['children']) && is_array($token_info['children'])) {
      $result += token_flatten_tree($token_info['children']);

      // unset($result[$token]['children']);
    }
  }
  return $result;
}