function HistoryUserTimestamp::render

Render the field.

Parameters

$values: The values retrieved from the database.

Overrides Node::render

File

drupal/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php, line 72
Contains \Drupal\history\Plugin\views\field\HistoryUserTimestamp.

Class

HistoryUserTimestamp
Field handler to display the marker for new content.

Namespace

Drupal\history\Plugin\views\field

Code

function render($values) {

  // Let's default to 'read' state.
  // This code shadows node_mark, but it reads from the db directly and
  // we already have that info.
  $mark = MARK_READ;
  global $user;
  if ($user->uid) {
    $last_read = $this
      ->getValue($values);
    $changed = $this
      ->getValue($values, 'changed');
    $last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this
      ->getValue($values, 'last_comment') : 0;
    if (!$last_read && $changed > HISTORY_READ_LIMIT) {
      $mark = MARK_NEW;
    }
    elseif ($changed > $last_read && $changed > HISTORY_READ_LIMIT) {
      $mark = MARK_UPDATED;
    }
    elseif ($last_comment > $last_read && $last_comment > HISTORY_READ_LIMIT) {
      $mark = MARK_UPDATED;
    }
    return $this
      ->render_link(theme('mark', array(
      'mark_type' => $mark,
    )), $values);
  }
}