You are here

function heartbeat_token_values in Heartbeat 6.3

Implementation of hook_token_values().

File

./heartbeat.module, line 542

Code

function heartbeat_token_values($type, $object = NULL, $options = array()) {

  // dsm('heartbeat_activity_token_values: type: '.$type);
  // dsm($object);
  $values = array();
  switch ($type) {
    case 'boolean':
      $values['1-or-0'] = $object ? '1' : '0';
      break;
    case 'rules_data_type_heartbeat_message_id':
      $values['message-id'] = $object;
      $values['message-id-raw'] = (int) $object;
      break;
    case 'rules_data_type_heartbeat_access':
      $values['message-access'] = (int) $object;
      break;
    case 'heartbeat_message':
      $values['heartbeat-message-raw'] = check_plain($object->message);
      break;
    case 'node':
      $values['title-link'] = l($object->title, 'node/' . $object->nid);
      $values['author-name-url'] = l($object->name, 'user/' . $object->uid, array(
        'attributes' => array(
          'class' => 'user',
        ),
      ));
      break;
    case 'user':
      $values['user-name-url'] = l($object->name, 'user/' . $object->uid, array(
        'attributes' => array(
          'class' => 'user',
        ),
      ));
      $values['user-profile-url'] = l($object->name, 'profile/' . $object->name, array(
        'attributes' => array(
          'class' => 'user',
        ),
      ));
      break;
    case 'global':
      break;
  }

  //dsm($values);
  return $values;
}