You are here

function shurly_handler_field_short_url::render in ShURLy 7

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

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

File

views/shurly_handler_field_short_url.inc, line 57
Shurly Views handler for short URL

Class

shurly_handler_field_short_url
Field handler to present a link to the short URL entry.

Code

function render($values) {
  global $base_url;

  // rawurldecode() allows URLs to be shown with UTF8 characters
  // however, this could cause other problems...
  if (!empty($this->options['text'])) {
    $text = $this->options['text'];
  }
  else {
    if ($this->options['longshort']) {
      $text = $values->{$this->aliases['source']};
    }
    else {
      $text = rawurldecode(_surl($values->{$this->aliases['source']}, array(
        'absolute' => TRUE,
        'base_url' => variable_get('shurly_base', $base_url),
      )));
    }
  }
  if ($this->options['link']) {
    $text = '<a href="' . _surl($values->{$this->aliases['source']}, array(
      'absolute' => TRUE,
      'base_url' => variable_get('shurly_base', $base_url),
    )) . '">' . $text . '</a>';
  }
  return $text;
}