You are here

public function revisioning_handler_field_node_state::render in Revisioning 7

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. 6.3 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)

Overrides views_handler_field::render

File

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

Class

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

Code

public function render($values) {
  $published = $values->{$this->aliases['published']};
  $nid = $values->{$this->aliases['nid']};
  $current_vid = $values->{$this->aliases['vid']};
  $is_initial_unpublished_draft = !$published && revisioning_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;
}