You are here

function views_sort_expression_views_post_build in Views Sort Expression 7

Same name and namespace in other branches
  1. 8 views_sort_expression.module \views_sort_expression_views_post_build()

Implements hook_views_post_build().

Remove views_sort_expression from group by if it was configured as a group by manually

File

./views_sort_expression.module, line 20

Code

function views_sort_expression_views_post_build(&$view) {
  foreach ($view->sort as $handler) {
    if ($handler instanceof views_sort_expression_handler) {
      if ($handler->options['aggregate']) {
        $alias = $handler->real_field . '_' . $handler->position;
        $group_by =& $view->build_info['query']
          ->getGroupBy();
        unset($group_by[$alias]);
      }
    }
  }
}