You are here

function drupagram_views_handler_field_images::render in Drupagram 6

Same name and namespace in other branches
  1. 7 drupagram_views_field_handlers.inc \drupagram_views_handler_field_images::render()

File

views/drupagram_views_handler_field_images.inc, line 40
Views handler for instagram images

Class

drupagram_views_handler_field_images
Field handler to provide simple renderer that turns a URL into a clickable link.

Code

function render($values) {
  $value = $values->{$this->field_alias};
  $images = unserialize($value);
  if (!empty($this->options['source'])) {
    $source = $this->options['source'];
  }
  $image = theme('image', $images[$source]['url'], '', '', NULL, FALSE);
  if ($this->options['link_to_post'] && isset($values->drupagram_link) && !empty($values->drupagram_link)) {
    return l($image, $values->drupagram_link, array(
      'html' => TRUE,
      'attributes' => array(
        'target' => '_blank',
        'rel' => 'nofollow',
      ),
    ));
  }
  return $image;
}