You are here

function _views_navigation_render_entity_link in Views navigation 7

Based on EntityFieldHandlerHelper::render_entity_link().

Parameters

object $handler: The field handler whose field is rendered.

string $value: The single value to render.

object $values: The values for the current row retrieved from the Views query, as an object.

Return value

string The rendered value.

3 calls to _views_navigation_render_entity_link()
views_navigation_handler_entity_field_field::render_entity_link in views/views_navigation_handler_entity_field_field.inc
Invoked by EntityFieldHandlerHelper::render_entity_link().
views_navigation_handler_entity_field_text::render_entity_link in views/views_navigation_handler_entity_field_text.inc
Invoked by EntityFieldHandlerHelper::render_entity_link().
views_navigation_handler_entity_field_uri::render_entity_link in views/views_navigation_handler_entity_field_uri.inc
Invoked by EntityFieldHandlerHelper::render_entity_link().

File

./views_navigation.inc, line 389
Views navigation main include file.

Code

function _views_navigation_render_entity_link($handler, $value, $values) {
  $render = EntityFieldHandlerHelper::render_single_value($handler, $value, $values);
  if (!$handler->options['link_to_entity']) {
    return $render;
  }
  $entity = $handler
    ->get_value($values, 'entity object');
  if (is_object($entity) && ($uri = entity_uri($handler->entity_type, $entity))) {
    $id_key = _views_navigation_get_id_key($handler->entity_type);
    if (isset($entity->{$id_key})) {
      $uri['options']['query'] = _views_navigation_build_query($entity->{$id_key}, $handler->view);
    }
    return l($render, $uri['path'], [
      'html' => TRUE,
    ] + $uri['options']);
  }
  return $render;
}