function Taxonomy::render_link

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

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

2 calls to Taxonomy::render_link()
Language::render in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Language.php
Overrides Drupal\taxonomy\Plugin\views\field\Taxonomy::render().
Taxonomy::render in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php
Render the field.

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/Taxonomy.php, line 71
Definition of Drupal\taxonomy\Plugin\views\field\Taxonomy.

Class

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

Namespace

Drupal\taxonomy\Plugin\views\field

Code

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