You are here

function revisioning_handler_field_node_state::render in Revisioning 6.3

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

Implement the rendering of the state value.

Note that $values contains: o nid o node_vid (current revision id) o node_status (published flag)

File

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

Class

revisioning_handler_field_node_state
@file Handler for the 'Node: state' field.

Code

function render($values) {
  $published = $values->{$this->aliases['published']};
  $nid = $values->{$this->aliases['nid']};
  $current_vid = $values->{$this->aliases['vid']};
  $is_initial_unpublished_draft = !$published && node_tools_get_number_of_revisions($nid) == 1;
  $latest_vid = revisioning_get_latest_revision_id($nid);
  $is_pending = $latest_vid > $current_vid || $is_initial_unpublished_draft;
  $description = $is_pending ? !$published && !$is_initial_unpublished_draft ? t('Archived with revision pending') : t('Revision pending') : ($published && $latest_vid == $current_vid ? t('Current, published') : t('Archived'));
  return $description;
}