1 views_handler_field_entity.inc views_handler_field_entity::get_value($values, $field = NULL)

Overridden to return the entity object, or a certain property of the entity.

Overrides views_handler_field::get_value

File

core/modules/views/handlers/views_handler_field_entity.inc, line 87
Definition of views_handler_field_entity.

Class

views_handler_field_entity
A handler to display data from entity objects.

Code

function get_value($values, $field = NULL) {
  if (isset($this->entities[$this->view->row_index])) {
    $entity = $this->entities[$this->view->row_index];
    // Support to get a certain part of the entity.
    if (isset($field) && isset($entity->{$field})) {
      return $entity->{$field};
    }
    // Support to get a part of the values as the normal get_value.
    elseif (isset($field) && isset($values->{$this->aliases[$field]})) {
      return $values->{$this->aliases[$field]};
    }
    else {
      return $entity;
    }
  }
  return FALSE;
}