You are here

public function views_handler_title_field::render_item in Title 7

Overrides views_handler_field_field::render_item

File

views/views_handler_title_field.inc, line 45

Class

views_handler_title_field
Field handler to present field title with link to the entity.

Code

public function render_item($count, $item) {
  if (!empty($this->options['link_to_entity'])) {
    $values = $this->original_values;
    $entity_type = $this->definition['entity_tables'][$this->base_table];
    $key = $this->field_alias;
    if (!empty($values->_field_data[$key]['entity'])) {
      $entity = $values->_field_data[$key]['entity'];
      $uri = entity_uri($entity_type, $entity);
      $this->options['alter']['make_link'] = TRUE;
      $this->options['alter']['path'] = $uri['path'];
      $this->options['alter']['options'] = !empty($uri['options']) ? $uri['options'] : array();
    }
  }
  return parent::render_item($count, $item);
}