You are here

function shurly_handler_field_short_url::render in ShURLy 6

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

File

views/shurly_handler_field_short_url.inc, line 56
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) {

  // 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,
      )));
    }
  }
  if ($this->options['link']) {
    $text = '<a href="' . _surl($values->{$this->aliases['source']}, array(
      'absolute' => TRUE,
    )) . '">' . $text . '</a>';
  }
  return $text;
}