You are here

function drupagram_views_handler_field_likes::render in Drupagram 6

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

File

views/drupagram_views_handler_field_likes.inc, line 55
Views handler for field likes

Class

drupagram_views_handler_field_likes
Field handler to show data of serialized fields.

Code

function render($values) {
  $value = $values->{$this->field_alias};
  if ($this->options['format'] == 'unserialized') {
    $value = (array) unserialize($value);
    return theme('drupagram_likes', $value);
  }
  elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
    $value = (array) unserialize($value);
    if ($this->options['key'] == 'count') {
      return check_plain($value[$this->options['key']]);
    }
    elseif ($this->options['key'] == 'data') {
      return theme('drupagram_likes_data', array(
        'data' => $value[$this->options['key']],
      ));
    }
  }
  return $value;
}