function Taxonomy::render_link in Views (for Drupal 7) 8.3
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 lib/
Views/ taxonomy/ Plugin/ views/ field/ Language.php - Overrides Views\taxonomy\Plugin\views\field\Taxonomy::render().
- Taxonomy::render in lib/
Views/ taxonomy/ Plugin/ views/ field/ Taxonomy.php - Render the field.
File
- lib/
Views/ taxonomy/ Plugin/ views/ field/ Taxonomy.php, line 77 - Definition of Views\taxonomy\Plugin\views\field\Taxonomy.
Class
- Taxonomy
- Field handler to provide simple renderer that allows linking to a taxonomy term.
Namespace
Views\taxonomy\Plugin\views\fieldCode
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,
'vid' => $this
->get_value($values, 'vid'),
'vocabulary_machine_name' => $values->{$this->aliases['vocabulary_machine_name']},
));
$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;
}