You are here

function revisioning_handler_field_revision_state::render in Revisioning 6.3

Same name and namespace in other branches
  1. 8 views/revisioning_handler_field_revision_state.inc \revisioning_handler_field_revision_state::render()
  2. 6.4 views/revisioning_handler_field_revision_state.inc \revisioning_handler_field_revision_state::render()
  3. 7 views/revisioning_handler_field_revision_state.inc \revisioning_handler_field_revision_state::render()

Note that $values contains: o node_revisions_nid (parent node id) o node_revisions_vid (revision id) o node_status (published flag) o node_vid (current revision id)

File

views/revisioning_handler_field_revision_state.inc, line 35
Handler for the 'Node revision: state' field.

Class

revisioning_handler_field_revision_state
@file Handler for the 'Node revision: state' field.

Code

function render($values) {
  $nid = $values->{$this->aliases['nid']};
  $vid = $values->{$this->aliases['vid']};
  $published = $values->{$this->aliases['published']};
  $current_vid = $values->{$this->aliases['current_vid']};
  $is_initial_unpublished_draft = !$published && node_tools_get_number_of_revisions($nid) == 1;
  $is_pending = $vid > $current_vid || $is_initial_unpublished_draft;
  $state_code = $is_pending ? REVISION_PENDING : ($vid == $current_vid ? REVISION_CURRENT : REVISION_ARCHIVED);
  $description = revisioning_revision_states($state_code);
  return $description;
}