You are here

function drupagram_views_handler_field_caption::render in Drupagram 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

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

Class

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

Code

function render($values) {
  $value = $this
    ->get_value($values);
  $caption = $value ? unserialize($value) : array();
  if ($this->options['format'] == 'unserialized') {
    return theme('drupagram_caption', $caption);
  }
  elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
    switch ($this->options['key']) {
      case 'created_time':
        return format_date($caption['created_time']);
        break;
      case 'from':
        return theme('drupagram_account', $caption['from']);
        break;
      default:
        return $this
          ->sanitize_value($caption[$this->options['key']]);
        break;
    }
  }
}