1 views_handler_field_taxonomy.inc views_handler_field_taxonomy::render_link($data, $values)

Render whatever the data is as a link to the taxonomy.

Data should be made XSS safe prior to calling this function.

File

core/modules/taxonomy/views/views_handler_field_taxonomy.inc, line 57
Definition of views_handler_field_taxonomy.

Class

views_handler_field_taxonomy
Field handler to provide simple renderer that allows linking to a taxonomy term.

Code

function render_link($data, $values) {
  $tid = $this->get_value($values, 'tid');
  if (!empty($this->options['link_to_taxonomy']) && !empty($tid) && $data !== NULL && $data !== '') {
    $term = entity_create('taxonomy_term', array(
      'tid' => $tid,
      'vocabulary' => $this->get_value($values, 'vocabulary'),
    ));
    $this->options['alter']['make_link'] = TRUE;
    $uri = entity_uri('taxonomy_term', $term);
    $this->options['alter']['path'] = $uri['path'];
  }

  if (!empty($this->options['convert_spaces'])) {
    $data = str_replace(' ', '-', $data);
  }

  return $data;
}