You are here

function rolereference_token_values in Role Reference 6

File

./rolereference.module, line 919
Defines a field type for referencing a role. Based almost entirely on nodereference and userreference modules.

Code

function rolereference_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'field') {
    $item = $object[0];
    $tokens['rid'] = $item['rid'];
    $tokens['role'] = $item['view'];
    $all = array();
    foreach ($object as $item) {
      $all['rid-all'][] = $item['rid'];
      $all['role-all'][] = $item['view'];
    }
    foreach ($all as $key => $values) {
      $tokens[$key] = theme('rolereference_tokens_all', $values, $key);
    }
    return $tokens;
  }
}