You are here

function view_alias_tokens in View Alias 7

Implemntats hook_tokens()

File

./view_alias.tokens.inc, line 11
Tokens support for Views Alias

Code

function view_alias_tokens($type, $tokens, $data = array(), $options = array()) {
  if ($type != 'view_alias') {
    return array();
  }
  $replacements = array();
  foreach ($tokens as $token => $raw) {
    list($field, $token) = explode(':', $token, 2);
    $term_tokens = token_find_with_prefix(array(
      $token => $raw,
    ), 'term');
    $replacements += token_generate('term', $term_tokens, array(
      'term' => $data[$field],
    ), $options);
  }
  return $replacements;
}