You are here

function drupagram_views_handler_field_likes::render in Drupagram 7

Same name and namespace in other branches
  1. 6 views/drupagram_views_handler_field_likes.inc \drupagram_views_handler_field_likes::render()

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

./drupagram_views_field_handlers.inc, line 197
Drupagram views field handlers.

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;
}