You are here

function views_handler_sort_formula::query in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 handlers/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);
}