You are here

function token_custom_token_values in Custom Tokens 5

Same name and namespace in other branches
  1. 6 token_custom.module \token_custom_token_values()

Implementation of hook_token_values()

File

./token_custom.module, line 107

Code

function token_custom_token_values($type, $object = NULL, $options = array()) {
  $result = db_query("SELECT * FROM {token_custom} WHERE type = '%s'", $type);
  while ($row = db_fetch_object($result)) {
    switch ($row->type) {
      case 'taxonomy':
      case 'node':
      case 'comment':
      case 'user':
        $tokens[$row->id] = _token_eval($row->php, $row->type, $object);
        break;
      case 'global':
        $tokens[$row->id] = _token_eval($row->php, $row->type);
        break;
    }
  }
  return $tokens;
}