You are here

function token_autocomplete in Token 7

File

./token.pages.inc, line 297
User page callbacks for the token module.

Code

function token_autocomplete() {
  $args = func_get_args();
  $string = implode('/', $args);
  $token_info = token_info();
  preg_match_all('/\\[([^\\s\\]:]*):?([^\\s\\]]*)?\\]?/', $string, $matches);
  $types = $matches[1];
  $tokens = $matches[2];
  foreach ($types as $index => $type) {
    if (!empty($tokens[$index]) || isset($token_info['types'][$type])) {
      token_autocomplete_token($type, $tokens[$index]);
    }
    else {
      token_autocomplete_type($type);
    }
  }
}