1 handlers.inc views_handler::get_field($field = NULL)

Shortcut to get a handler's raw field value.

This should be overridden for handlers with formulae or other non-standard fields. Because this takes an argument, fields overriding this can just call return parent::get_field($formula)

File

core/modules/views/includes/handlers.inc, line 176
Defines the various handler objects to help build and display views.

Class

views_handler
Base handler, from which all the other handlers are derived. It creates a common interface to create consistency amongst handlers and data.

Code

function get_field($field = NULL) {
  if (!isset($field)) {
    if (!empty($this->formula)) {
      $field = $this->get_formula();
    }
    else {
      $field = $this->table_alias . '.' . $this->real_field;
    }
  }

  // If grouping, check to see if the aggregation method needs to modify the field.
  if ($this->view->display_handler->use_group_by()) {
    $this->view->init_query();
    if ($this->query) {
      $info = $this->query->get_aggregation_info();
      if (!empty($info[$this->options['group_type']]['method']) && function_exists($info[$this->options['group_type']]['method'])) {
        return $info[$this->options['group_type']]['method']($this->options['group_type'], $field);
      }
    }
  }

  return $field;
}