You are here

function _token_profile_fields in Token 7

Fetch an array of profile field objects, keyed by token name.

2 calls to _token_profile_fields()
profile_tokens in ./token.tokens.inc
Implements hook_tokens() on behalf of profile.module.
profile_token_info in ./token.tokens.inc
Implements hook_token_info() on behalf of profile.module.
1 string reference to '_token_profile_fields'
token_clear_cache in ./token.module
Clear token caches and static variables.

File

./token.tokens.inc, line 1266
Token callbacks for the token module.

Code

function _token_profile_fields() {
  $fields =& drupal_static(__FUNCTION__);
  if (!isset($fields)) {
    $fields = array();
    $results = db_query("SELECT name, title, category, type FROM {profile_field}");
    foreach ($results as $field) {
      $field->token_name = token_clean_token_name($field->name);
      $fields[$field->token_name] = $field;
    }
  }
  return $fields;
}