You are here

function image_gallery_handler_field_gallery_cover_latest_time::render in Image 6

Same name and namespace in other branches
  1. 7 contrib/image_gallery/views/image_gallery_handler_field_gallery_cover_latest_time.inc \image_gallery_handler_field_gallery_cover_latest_time::render()

Returns field html.

Overrides image_gallery_handler_field_gallery_cover::render

File

contrib/image_gallery/views/image_gallery_handler_field_gallery_cover_latest_time.inc, line 23

Class

image_gallery_handler_field_gallery_cover_latest_time
Field handler for the gallery's updated time.

Code

function render($values) {
  $nid = $this
    ->get_cover_node_nid($values);

  // If there is no node (ie gallery empty), suppress the label.
  // Because this is called for each row, but $this->options['label'] applies
  // to everything, we have to muck about and stash the original, user-set
  // value so we can restore it when needed.
  // @todo: views 6.x-2.7 will make all the label stuff superfluous.
  static $original_label;
  if (!isset($original_label)) {
    $original_label = $this->options['label'];
  }
  if (isset($nid)) {
    $this->options['label'] = $original_label;
    $latest_node = node_load($nid);
    $output = theme('image_gallery_updated', $latest_node->changed);
    return $this
      ->render_link($output, $values);
  }
  else {
    $this->options['label'] = '';
  }
}