You are here

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

Same name and namespace in other branches
  1. 7.3 plugins/views_plugin_exposed_form.inc \views_plugin_exposed_form::query()

Add anything to the query that we might need to.

Overrides views_plugin::query

1 call to views_plugin_exposed_form::query()
views_plugin_exposed_form_input_required::query in plugins/views_plugin_exposed_form_input_required.inc
Add anything to the query that we might need to.
1 method overrides views_plugin_exposed_form::query()
views_plugin_exposed_form_input_required::query in plugins/views_plugin_exposed_form_input_required.inc
Add anything to the query that we might need to.

File

plugins/views_plugin_exposed_form.inc, line 161

Class

views_plugin_exposed_form
The base plugin to handle exposed filter forms.

Code

function query() {
  $view = $this->view;
  $exposed_data = $view->exposed_data;
  if (!empty($exposed_data['sort_by'])) {
    $handler = $view->sort[$exposed_data['sort_by']];
    if (isset($handler)) {
      $view->query->orderby = array();
      if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], array(
        'ASC',
        'DESC',
      ))) {
        $handler->options['order'] = $exposed_data['sort_order'];
      }
      $handler
        ->query();
      foreach ($view->sort as $sort) {
        if (!$sort
          ->is_exposed()) {
          $sort
            ->query();
        }
      }
    }
  }
}