You are here

function token_custom_token_values in Custom Tokens 6

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

Implementation of hook_token_values()

File

./token_custom.module, line 124
The Token Custom module.

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;
}