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

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

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

File

core/modules/node/views/views_handler_field_node.inc, line 53
Contains the basic 'node' field handler.

Class

views_handler_field_node
Field handler to provide simple renderer that allows linking to a node. Definition terms:

Code

function render_link($data, $values) {
  if (!empty($this->options['link_to_node']) && !empty($this->additional_fields['nid'])) {
    if ($data !== NULL && $data !== '') {
      $this->options['alter']['make_link'] = TRUE;
      $this->options['alter']['path'] = "node/" . $this->get_value($values, 'nid');
      if (isset($this->aliases['langcode'])) {
        $languages = language_list();
        $language = $this->get_value($values, 'langcode');
        if (isset($languages[$language])) {
          $this->options['alter']['langcode'] = $languages[$language];
        }
        else {
          unset($this->options['alter']['langcode']);
        }
      }
    }
    else {
      $this->options['alter']['make_link'] = FALSE;
    }
  }
  return $data;
}