You are here

function EntityFieldQuery::add_selector_orderby in EntityFieldQuery Views Backend 8

File

src/Plugin/views/query/EntityFieldQuery.php, line 321

Class

EntityFieldQuery
Views query plugin for an SQL query.

Namespace

Drupal\efq_views\Plugin\views\query

Code

function add_selector_orderby($selector, $order = 'ASC') {
  $views_data = views_fetch_data($this->base_table);
  $sort_data = $views_data[$selector]['sort'];
  switch ($sort_data['handler']) {
    case 'efq_views_handler_sort_entity':
      $this->query
        ->entityOrderBy($selector, $order);
      break;
    case 'efq_views_handler_sort_property':
      $this->query
        ->propertyOrderBy($selector, $order);
      break;
    case 'efq_views_handler_sort_field':
      $this->query
        ->fieldOrderBy($sort_data['field_name'], $sort_data['field'], $order);
      break;
  }
}