You are here

function revisioning_token_values in Revisioning 6.4

Same name and namespace in other branches
  1. 6.3 revisioning_tokens.inc \revisioning_token_values()

Implementation of hook_token_values().

File

./revisioning_tokens.inc, line 41
Add tokens pertaining to the Revisioning module.

Code

function revisioning_token_values($type, $object = NULL, $options = array()) {
  $values = array();
  switch ($type) {
    case 'node':
      $values['vid'] = $object->vid;
      $values['revision-title'] = $object->title;
      _set_revision_author_values($object->revision_uid, $values);
      break;
    case 'op':
      switch ($object) {
        case 'publish':
        case 'revert':
        case 'unpublish':
          $nid = arg(1);
          $revision = node_load($nid, node_tools_get_current_node_revision_id($nid));
          $values['vid'] = $revision->vid;
          $values['revision-title'] = $revision->title;
          _set_revision_author_values($revision->revision_uid, $values);
      }
      break;
  }
  return $values;
}