function views_handler_sort_formula::query

2.x views_handler_sort_formula.inc views_handler_sort_formula::query()

Called to add the sort to a query.

Overrides views_handler_sort::query

File

handlers/views_handler_sort_formula.inc, line 30

Class

views_handler_sort_formula
Base sort handler that has no options and performs a simple sort

Code

function query() {
  if (is_array($this->formula)) {
    global $db_type;
    if (isset($this->formula[$db_type])) {
      $formula = $this->formula[$db_type];
    }
    else {
      $formula = $this->formula['default'];
    }
  }
  else {
    $formula = $this->formula;
  }
  $this->ensure_my_table();
  // Add the field.
  $this->query->add_orderby(NULL, $formula, $this->options['order'], $this->table_alias . '_' . $this->field);
}